List of usage examples for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding readableName
@Override public char[] readableName()
From source file:com.android.build.gradle.tasks.annotations.TypedefCollector.java
License:Apache License
private boolean recordTypedefs(TypeDeclaration declaration) { SourceTypeBinding binding = declaration.binding; if (binding == null) { return false; }/*from ww w . j a v a2s. c o m*/ Annotation[] annotations = declaration.annotations; if (annotations != null) { if (declaration.binding.isAnnotationType()) { for (Annotation annotation : annotations) { String typeName = Extractor.getFqn(annotation); if (typeName == null) { continue; } if (Extractor.isNestedAnnotation(typeName)) { String fqn = new String(binding.readableName()); List<Annotation> list = mMap.get(fqn); if (list == null) { list = new ArrayList<Annotation>(2); mMap.put(fqn, list); } list.add(annotation); if (mRequireHide) { Javadoc javadoc = declaration.javadoc; if (javadoc != null) { StringBuffer stringBuffer = new StringBuffer(200); javadoc.print(0, stringBuffer); String documentation = stringBuffer.toString(); if (!documentation.contains("@hide")) { Extractor.warning(getFileName() + ": The typedef annotation " + fqn + " should specify @hide in a doc comment"); } } } if (mRequireSourceRetention && !Extractor.hasSourceRetention(annotations)) { Extractor.warning(getFileName() + ": The typedef annotation " + fqn + " should have @Retention(RetentionPolicy.SOURCE)"); } if (declaration.binding != null && (declaration.modifiers & ClassFileConstants.AccPublic) == 0) { StringBuilder sb = new StringBuilder(100); for (char c : declaration.binding.qualifiedPackageName()) { if (c == '.') { sb.append('/'); } else { sb.append(c); } } sb.append(File.separatorChar); for (char c : declaration.binding.qualifiedSourceName()) { if (c == '.') { sb.append('$'); } else { sb.append(c); } } mTypedefClasses.add(sb.toString()); } } } } } return true; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.copyinheritance.CopyInheritance.java
License:Open Source License
/** * Entry for ClassScope: copy into `teamBinding' all roles of its super and tsuper teams. * Also connect roles with OT-specific links. *///from w ww.j a v a2 s . com public static void copyRoles(SourceTypeBinding teamBinding) { TeamModel teamModel = teamBinding.getTeamModel(); ReferenceBinding superTeam = teamBinding.superclass; if (superTeam == null) { assert (teamBinding.tagBits & TagBits.HierarchyHasProblems) != 0 : "Only broken teams can have null superclass"; //$NON-NLS-1$ return; } // super team: if (TeamModel.setTagBit(teamBinding, TeamModel.BeginCopyRoles)) { TSuperHelper.addMarkerInterface(teamModel, superTeam); copyRolesFromTeam(superTeam, teamModel, false/*isTsuperTeam*/); } // tsuper teams: if (teamBinding.isRole()) { ReferenceBinding[] tSuperRoleBindings = teamBinding.roleModel.getTSuperRoleBindings(); int length = tSuperRoleBindings.length; if (length > TeamModel.MaxTSuperRoles) throw new InternalCompilerError( "Too many tsuper roles in " + String.valueOf(teamBinding.readableName())); //$NON-NLS-1$ for (int i = 0; i < length; i++) { ReferenceBinding tsuperTeam = tSuperRoleBindings[i]; int tagBits = (1 << i) & TeamModel.CopyRolesFromTSuperMASK; if (TeamModel.setTagBit(teamBinding, tagBits)) { TSuperHelper.addMarkerInterface(teamModel, tsuperTeam); copyRolesFromTeam(tsuperTeam, teamModel, true/*isTsuperTeam*/); } } } teamModel.addAttribute(new InheritedRolesAttribute(teamModel.getBinding())); }