Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
1,100
void (final Mappings delta) { synchronized (myLock) { try { assert (delta.isDifferentiated()); final Collection<String> removed = delta.myRemovedFiles; delta.runPostPasses(); final IntIntMultiMaplet dependenciesTrashBin = new IntIntTransientMultiMaplet(); if (removed != null) { for (final String file : removed) { final File deletedFile = new File(file); final Set<ClassFileRepr> fileClasses = (Set<ClassFileRepr>)sourceFileToClassesGet(deletedFile); if (fileClasses != null) { for (final ClassFileRepr aClass : fileClasses) { cleanupRemovedClass(delta, aClass, deletedFile, aClass.getUsages(), dependenciesTrashBin); } myRelativeSourceFilePathToClasses.remove(myRelativizer.toRelative(file)); } } } if (!delta.isRebuild()) { for (final Pair<ClassFileRepr, File> pair : delta.getDeletedClasses()) { final ClassFileRepr deletedClass = pair.first; cleanupRemovedClass(delta, deletedClass, pair.second, deletedClass.getUsages(), dependenciesTrashBin); } for (ClassRepr repr : delta.getAddedClasses()) { if (!repr.isAnonymous() && !repr.isLocal()) { myShortClassNameIndex.put(myContext.get(repr.getShortName()), repr.name); } } final IntSet superClasses = new IntOpenHashSet(); final IntIntTransientMultiMaplet addedSuperClasses = delta.getAddedSuperClasses(); final IntIntTransientMultiMaplet removedSuperClasses = delta.getRemovedSuperClasses(); addAllKeys(superClasses, addedSuperClasses); addAllKeys(superClasses, removedSuperClasses); superClasses.forEach(superClass -> { final IntSet added = addedSuperClasses.get(superClass); IntSet removed12 = removedSuperClasses.get(superClass); final IntSet old = myClassToSubclasses.get(superClass); if (old == null) { if (added != null && !added.isEmpty()) { myClassToSubclasses.replace(superClass, added); } } else { boolean changed = false; final int[] addedAsArray = added == null || added.isEmpty() ? null : added.toIntArray(); if (removed12 != null && !removed12.isEmpty()) { if (addedAsArray != null) { // optimization: avoid unnecessary changes in the set removed12 = new IntOpenHashSet(removed12); removed12.removeAll(IntSet.of(addedAsArray)); } if (!removed12.isEmpty()) { changed = old.removeAll(removed12); } } if (addedAsArray != null) { changed |= old.addAll(IntSet.of(addedAsArray)); } if (changed) { myClassToSubclasses.replace(superClass, old); } } }); final Set<String> changedRelativePaths = CollectionFactory.createFilePathSet(); for (File file : delta.getChangedFiles()) { changedRelativePaths.add(toRelative(file)); } delta.getChangedClasses().forEach(new IntConsumer() { final Set<String> pathsBuffer = CollectionFactory.createFilePathSet(); @Override public void accept(int className) { Collection<String> currentPaths = myClassToRelativeSourceFilePath.get(className); if (currentPaths != null && !currentPaths.isEmpty()) { try { pathsBuffer.addAll(currentPaths); pathsBuffer.removeAll(changedRelativePaths); pathsBuffer.addAll(delta.myClassToRelativeSourceFilePath.get(className)); if (pathsBuffer.size() != currentPaths.size() || !pathsBuffer.containsAll(currentPaths)) { myClassToRelativeSourceFilePath.replace(className, pathsBuffer); } } finally { pathsBuffer.clear(); } } else { myClassToRelativeSourceFilePath.replace(className, delta.myClassToRelativeSourceFilePath.get(className)); } cleanupBackDependency(className, null, dependenciesTrashBin); } }); for (String path : changedRelativePaths) { myRelativeSourceFilePathToClasses.replace(path, delta.myRelativeSourceFilePathToClasses.get(path)); } // some classes may be associated with multiple sources. // In case some of these sources was not compiled, but the class was changed, we need to update // sourceToClasses mapping for such sources to include the updated ClassRepr version of the changed class Set<File> unchangedSources = FileCollectionFactory.createCanonicalFileSet(); delta.myRelativeSourceFilePathToClasses.forEachEntry((source, b) -> { unchangedSources.add(toFull(source)); return true; }); unchangedSources.removeAll(delta.getChangedFiles()); if (!unchangedSources.isEmpty()) { unchangedSources.forEach(unchangedSource -> { final Collection<ClassFileRepr> updatedClasses = delta.sourceFileToClassesGet(unchangedSource); if (updatedClasses != null && !updatedClasses.isEmpty()) { final List<ClassFileRepr> classesToPut = new ArrayList<>(); final IntSet updatedClassNames = new IntOpenHashSet(); for (ClassFileRepr aClass : updatedClasses) { // from all generated classes on this round consider only 'differentiated' ones, for // which we can reliably say that the class has changed. Keep classes, for which no such checks were made, // to make it possible to create a diff and compare changes on next compilation rounds. if (delta.getChangedClasses().contains(aClass.name)) { classesToPut.add(aClass); updatedClassNames.add(aClass.name); } } final Collection<ClassFileRepr> currentClasses = sourceFileToClassesGet(unchangedSource); if (currentClasses != null) { for (ClassFileRepr aClass : currentClasses) { if (!updatedClassNames.contains(aClass.name)) { classesToPut.add(aClass); } } } myRelativeSourceFilePathToClasses.replace(toRelative(unchangedSource), classesToPut); } }); } } else { myClassToSubclasses.putAll(delta.myClassToSubclasses); myClassToRelativeSourceFilePath.putAll(delta.myClassToRelativeSourceFilePath); myRelativeSourceFilePathToClasses.replaceAll(delta.myRelativeSourceFilePathToClasses); delta.myRelativeSourceFilePathToClasses.forEachEntry( (src, classes) -> { for (ClassFileRepr repr : classes) { if (repr instanceof ClassRepr) { final ClassRepr clsRepr = (ClassRepr)repr; if (!clsRepr.isAnonymous() && !clsRepr.isLocal()) { myShortClassNameIndex.put(myContext.get(clsRepr.getShortName()), repr.name); } } } return true; }); } // updating classToClass dependencies final IntSet affectedClasses = new IntOpenHashSet(); addAllKeys(affectedClasses, dependenciesTrashBin); addAllKeys(affectedClasses, delta.myClassToClassDependency); affectedClasses.forEach(aClass -> { final IntSet toRemove = dependenciesTrashBin.get(aClass); if (toRemove != null) { myClassToClassDependency.removeAll(aClass, toRemove); } final IntSet toAdd = delta.myClassToClassDependency.get(aClass); if (toAdd != null) { myClassToClassDependency.put(aClass, toAdd); } }); } finally { delta.close(); } } }
integrate
1,101
void (int className) { Collection<String> currentPaths = myClassToRelativeSourceFilePath.get(className); if (currentPaths != null && !currentPaths.isEmpty()) { try { pathsBuffer.addAll(currentPaths); pathsBuffer.removeAll(changedRelativePaths); pathsBuffer.addAll(delta.myClassToRelativeSourceFilePath.get(className)); if (pathsBuffer.size() != currentPaths.size() || !pathsBuffer.containsAll(currentPaths)) { myClassToRelativeSourceFilePath.replace(className, pathsBuffer); } } finally { pathsBuffer.clear(); } } else { myClassToRelativeSourceFilePath.replace(className, delta.myClassToRelativeSourceFilePath.get(className)); } cleanupBackDependency(className, null, dependenciesTrashBin); }
accept
1,102
void (String classFileName, Collection<String> sources, ClassReader cr, boolean isGenerated) { synchronized (myLock) { final int classFileNameS = myContext.get(classFileName); final ClassFileRepr result = new ClassfileAnalyzer(myContext).analyze(classFileNameS, cr, isGenerated); if (result != null) { // since java9 'repr' can represent either a class or a compiled module-info.java final int className = result.name; if (result instanceof ClassRepr) { final ClassRepr classRepr = (ClassRepr)result; final String classNameStr = myContext.getValue(className); if (addConstantUsages(classRepr, myConstantRefs.remove(classNameStr))) { // Important: should register constants before imports, because imports can produce additional // field references too and addConstantUsages may return false in this case classRepr.setHasInlinedConstants(true); } final Pair<Collection<String>, Collection<String>> imports = myImportRefs.remove(classNameStr); if (imports != null) { addImportUsages(classRepr, imports.getFirst(), imports.getSecond()); } } for (String sourceFileName : sources) { String relative = myRelativizer.toRelative(sourceFileName); myClassToRelativeSourceFilePath.put(className, relative); myRelativeSourceFilePathToClasses.put(relative, result); } if (result instanceof ClassRepr) { for (final TypeRepr.ClassType s : ((ClassRepr)result).getSuperTypes()) { myClassToSubclasses.put(s.className, className); } } for (final UsageRepr.Usage u : result.getUsages()) { final int owner = u.getOwner(); if (owner != className) { myClassToClassDependency.put(owner, className); } } } } }
associate
1,103
void (String className, Collection<String> classImports, Collection<String> staticImports) { final String key = className.replace('.', '/'); if (!classImports.isEmpty() || !staticImports.isEmpty()) { myImportRefs.put(key, Pair.create(classImports, staticImports)); } else { myImportRefs.remove(key); } }
registerImports
1,104
void (String className, Collection<Callbacks.ConstantRef> cRefs) { final String key = className.replace('.', '/'); if (!cRefs.isEmpty()) { myConstantRefs.put(key, cRefs); } else { myConstantRefs.remove(key); } }
registerConstantReferences
1,105
void (ClassRepr repr, Collection<String> classImports, Collection<String> staticImports) { for (final String anImport : classImports) { if (!anImport.endsWith(IMPORT_WILDCARD_SUFFIX)) { repr.addUsage(UsageRepr.createClassUsage(myContext, myContext.get(anImport.replace('.', '/')))); } } for (String anImport : staticImports) { if (anImport.endsWith(IMPORT_WILDCARD_SUFFIX)) { final int iname = myContext.get(anImport.substring(0, anImport.length() - IMPORT_WILDCARD_SUFFIX.length()).replace('.', '/')); repr.addUsage(UsageRepr.createClassUsage(myContext, iname)); repr.addUsage(UsageRepr.createImportStaticOnDemandUsage(myContext, iname)); } else { final int i = anImport.lastIndexOf('.'); if (i > 0 && i < anImport.length() - 1) { final int iname = myContext.get(anImport.substring(0, i).replace('.', '/')); final int memberName = myContext.get(anImport.substring(i+1)); repr.addUsage(UsageRepr.createClassUsage(myContext, iname)); repr.addUsage(UsageRepr.createImportStaticMemberUsage(myContext, memberName, iname)); } } } }
addImportUsages
1,106
boolean (ClassRepr repr, Collection<? extends Callbacks.ConstantRef> cRefs) { boolean addedNewUsages = false; if (cRefs != null) { for (Callbacks.ConstantRef ref : cRefs) { final int owner = myContext.get(ref.getOwner().replace('.', '/')); if (repr.name != owner) { addedNewUsages |= repr.addUsage(UsageRepr.createFieldUsage(myContext, myContext.get(ref.getName()), owner, myContext.get(ref.getDescriptor()))); } } } return addedNewUsages; }
addConstantUsages
1,107
Collection<File> (int className) { synchronized (myLock) { final Iterable<File> files = classToSourceFileGet(className); return files == null? Collections.emptyList() : ContainerUtil.collect(files.iterator()); } }
getClassSources
1,108
void () { BuildDataCorruptedException error = null; synchronized (myLock) { for (CloseableMaplet maplet : Arrays.asList(myClassToSubclasses, myClassToClassDependency, myRelativeSourceFilePathToClasses, myClassToRelativeSourceFilePath, myShortClassNameIndex)) { if (maplet != null) { try { maplet.close(); } catch (BuildDataCorruptedException ex) { if (error == null) { error = ex; } } } } if (!myIsDelta) { // only close if you own the context final DependencyContext context = myContext; if (context != null) { try { context.close(); } catch (BuildDataCorruptedException ex) { if (error == null) { error = ex; } } myContext = null; } } } if (error != null) { throw error; } }
close
1,109
void (final boolean memoryCachesOnly) { synchronized (myLock) { myClassToSubclasses.flush(memoryCachesOnly); myClassToClassDependency.flush(memoryCachesOnly); myRelativeSourceFilePathToClasses.flush(memoryCachesOnly); myClassToRelativeSourceFilePath.flush(memoryCachesOnly); if (!myIsDelta) { myShortClassNameIndex.flush(memoryCachesOnly); // flush if you own the context final DependencyContext context = myContext; if (context != null) { context.clearMemoryCaches(); if (!memoryCachesOnly) { context.flush(); } } } } }
flush
1,110
void (final IntSet whereToAdd, final IntIntMultiMaplet maplet) { maplet.forEachEntry((integers, value) -> whereToAdd.add(value)); }
addAllKeys
1,111
void (final int aClass, final int superClass) { assert (myAddedSuperClasses != null); myAddedSuperClasses.put(superClass, aClass); }
registerAddedSuperClass
1,112
void (final int aClass, final int superClass) { assert (myRemovedSuperClasses != null); myRemovedSuperClasses.put(superClass, aClass); }
registerRemovedSuperClass
1,113
boolean () { return myIsDifferentiated; }
isDifferentiated
1,114
boolean () { return myIsRebuild; }
isRebuild
1,115
void (final ClassFileRepr cr, File fileName) { assert (myDeletedClasses != null); myDeletedClasses.add(Pair.create(cr, fileName)); addChangedClass(cr.name); }
addDeletedClass
1,116
void (final ClassRepr cr) { assert (myAddedClasses != null); myAddedClasses.add(cr); addChangedClass(cr.name); }
addAddedClass
1,117
void (final int it) { assert (myChangedClasses != null && myChangedFiles != null); myChangedClasses.add(it); final Iterable<File> files = classToSourceFileGet(it); if (files != null) { ContainerUtil.addAll(myChangedFiles, files); } }
addChangedClass
1,118
Set<ClassRepr> () { return myAddedClasses == null ? Collections.emptySet() : Collections.unmodifiableSet(myAddedClasses); }
getAddedClasses
1,119
IntSet () { return myChangedClasses; }
getChangedClasses
1,120
Set<File> () { return myChangedFiles; }
getChangedFiles
1,121
void (final String s) { LOG.debug(s); }
debug
1,122
void (final String comment, final int s) { myDebugS.debug(comment, s); }
debug
1,123
void (final String comment, final File f) { debug(comment, f.getPath()); }
debug
1,124
void (final String comment, final String s) { myDebugS.debug(comment, s); }
debug
1,125
void (final String comment, final boolean s) { myDebugS.debug(comment, s); }
debug
1,126
void (final PrintStream stream) { final Streamable[] data = { myClassToSubclasses, myClassToClassDependency, myRelativeSourceFilePathToClasses, myClassToRelativeSourceFilePath, }; final String[] info = { "ClassToSubclasses", "ClassToClassDependency", "SourceFileToClasses", "ClassToSourceFile", "SourceFileToAnnotationUsages", "SourceFileToUsages" }; for (int i = 0; i < data.length; i++) { stream.print("Begin Of "); stream.println(info[i]); data[i].toStream(myContext, stream); stream.print("End Of "); stream.println(info[i]); } }
toStream
1,127
T () { return (calculated != null? calculated : (calculated = new Ref<>(calculation.get()))).get(); }
get
1,128
void (File outputRoot) { final Streamable[] data = { myClassToSubclasses, myClassToClassDependency, myRelativeSourceFilePathToClasses, myClassToRelativeSourceFilePath, myShortClassNameIndex }; final String[] info = { "ClassToSubclasses", "ClassToClassDependency", "SourceFileToClasses", "ClassToSourceFile", "ShortClassNameIndex" }; for (int i = 0; i < data.length; i++) { final File file = new File(outputRoot, info[i]); FileUtil.createIfDoesntExist(file); try (PrintStream stream = new PrintStream(file)) { data[i].toStream(myContext, stream); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
toStream
1,129
void (final DependencyContext context, final PrintStream stream) { final List<Pair<K, String>> keys = new ArrayList<>(); forEachEntry((a, b) -> { keys.add(Pair.create(a, debugString(a))); return true; }); keys.sort(Pair.comparingBySecond()); for (final Pair<K, String> a: keys) { final Collection<V> b = get(a.first); stream.print(" Key: "); stream.println(a.second); stream.println(" Values:"); final List<String> list = new LinkedList<>(); for (final V value : b) { if (value instanceof Streamable) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final PrintStream s = new PrintStream(baos); ((Streamable) value).toStream(context, s); list.add(baos.toString()); } } Collections.sort(list); for (final String l : list) { stream.print(l); } stream.println(" End Of Values"); } }
toStream
1,130
String (K k) { return k.toString(); }
debugString
1,131
Set<MethodRepr> () { return myMethods; }
getMethods
1,132
Set<FieldRepr> () { return myFields; }
getFields
1,133
int () { return myOuterClassName; }
getOuterClassName
1,134
boolean () { return myIsLocal; }
isLocal
1,135
boolean () { return myIsAnonymous; }
isAnonymous
1,136
boolean () { return myIsGenerated; }
isGenerated
1,137
boolean () { return myHasInlinedConstants; }
hasInlinedConstants
1,138
void (boolean hasConstants) { myHasInlinedConstants = hasConstants; }
setHasInlinedConstants
1,139
RetentionPolicy () { return myRetentionPolicy; }
getRetentionPolicy
1,140
Set<ElemType> () { final Set<ElemType> targets = myAnnotationTargets; return targets != null ? Collections.unmodifiableSet(targets) : Collections.emptySet(); }
getAnnotationTargets
1,141
boolean () { return (access & Opcodes.ACC_INTERFACE) != 0; }
isInterface
1,142
boolean () { return (access & Opcodes.ACC_ENUM) != 0; }
isEnum
1,143
boolean () { return base() == NONE && interfaces().unchanged() && fields().unchanged() && methods().unchanged() && targets().unchanged() && !retentionChanged(); }
no
1,144
Diff (final Proto past) { final ClassRepr pastClass = (ClassRepr)past; final Difference diff = super.difference(past); int base = diff.base(); if (!mySuperClass.equals(pastClass.mySuperClass)) { base |= Difference.SUPERCLASS; } if (!getUsages().equals(pastClass.getUsages())) { base |= Difference.USAGES; } if (hasInlinedConstants() != pastClass.hasInlinedConstants()) { base |= Difference.CONSTANT_REFERENCES; } final int d = base; return new Diff(diff) { @Override public boolean extendsAdded() { if ((d & Difference.SUPERCLASS) <= 0) { return false; } final String pastSuperName = myContext.getValue(((ClassRepr)past).mySuperClass.className); return "java/lang/Object".equals(pastSuperName); } @Override public Difference.Specifier<TypeRepr.ClassType, Difference> interfaces() { return Difference.make(pastClass.myInterfaces, myInterfaces); } @Override public Difference.Specifier<FieldRepr, Difference> fields() { return Difference.make(pastClass.myFields, myFields); } @Override public Difference.Specifier<MethodRepr, MethodRepr.Diff> methods() { return Difference.make(pastClass.myMethods, myMethods); } @Override public Specifier<ElemType, Difference> targets() { return Difference.make(pastClass.myAnnotationTargets, myAnnotationTargets); } @Override public boolean retentionChanged() { return !((myRetentionPolicy == null && pastClass.myRetentionPolicy == RetentionPolicy.CLASS) || (myRetentionPolicy == RetentionPolicy.CLASS && pastClass.myRetentionPolicy == null) || (myRetentionPolicy == pastClass.myRetentionPolicy)); } @Override public boolean targetAttributeCategoryMightChange() { final Specifier<ElemType, Difference> targetsDiff = targets(); if (!targetsDiff.unchanged()) { for (ElemType elemType : Set.of(ElemType.TYPE_USE, ElemType.RECORD_COMPONENT)) { if (targetsDiff.added().contains(elemType) || targetsDiff.removed().contains(elemType) || pastClass.getAnnotationTargets().contains(elemType) ) { return true; } } } return false; } @Override public int base() { return d; } @Override public boolean hadValue() { return false; } }; }
difference
1,145
boolean () { if ((d & Difference.SUPERCLASS) <= 0) { return false; } final String pastSuperName = myContext.getValue(((ClassRepr)past).mySuperClass.className); return "java/lang/Object".equals(pastSuperName); }
extendsAdded
1,146
boolean () { return !((myRetentionPolicy == null && pastClass.myRetentionPolicy == RetentionPolicy.CLASS) || (myRetentionPolicy == RetentionPolicy.CLASS && pastClass.myRetentionPolicy == null) || (myRetentionPolicy == pastClass.myRetentionPolicy)); }
retentionChanged
1,147
boolean () { final Specifier<ElemType, Difference> targetsDiff = targets(); if (!targetsDiff.unchanged()) { for (ElemType elemType : Set.of(ElemType.TYPE_USE, ElemType.RECORD_COMPONENT)) { if (targetsDiff.added().contains(elemType) || targetsDiff.removed().contains(elemType) || pastClass.getAnnotationTargets().contains(elemType) ) { return true; } } } return false; }
targetAttributeCategoryMightChange
1,148
int () { return d; }
base
1,149
boolean () { return false; }
hadValue
1,150
void (final DependencyContext context, final Set<? super UsageRepr.Usage> s) { mySuperClass.updateClassUsages(context, name, s); for (TypeRepr.AbstractType t : myInterfaces) { t.updateClassUsages(context, name, s); } for (MethodRepr m : myMethods) { m.updateClassUsages(context, name, s); } for (FieldRepr f : myFields) { f.updateClassUsages(context, name, s); } }
updateClassUsages
1,151
void (final DataOutput out) { try { super.save(out); mySuperClass.save(out); RW.save(myInterfaces, out); RW.save(myFields, out); RW.save(myMethods, out); RW.save(myAnnotationTargets, UsageRepr.AnnotationUsage.elementTypeExternalizer, out); RW.writeUTF(out, myRetentionPolicy == null ? "" : myRetentionPolicy.toString()); DataInputOutputUtil.writeINT(out, myOuterClassName); DataInputOutputUtil.writeINT( out, (myIsLocal ? LOCAL_MASK:0) | (myIsAnonymous ? ANONYMOUS_MASK : 0) | (myHasInlinedConstants ? HAS_INLINED_CONSTANTS_MASK : 0) | (myIsGenerated ? IS_GENERATED_MASK : 0) ); } catch (IOException e) { throw new BuildDataCorruptedException(e); } }
save
1,152
String () { final String strValue = myContext.getValue(name); return strValue != null? getPackageName(strValue) : null; }
getPackageName
1,153
String () { final String strValue = myContext.getValue(name); return strValue != null? getShortName(strValue) : null; }
getShortName
1,154
String (final @NotNull String raw) { final int index = raw.lastIndexOf('/'); if (index == -1) { return ""; } return raw.substring(0, index); }
getPackageName
1,155
String (final @NotNull String fqName) { final int index = fqName.lastIndexOf('/'); if (index == -1) { return fqName; } return fqName.substring(index + 1); }
getShortName
1,156
Collection<MethodRepr> (final Predicate<? super MethodRepr> p) { final Collection<MethodRepr> result = new LinkedList<>(); for (MethodRepr mm : myMethods) { if (p.test(mm)) { result.add(mm); } } return result; }
findMethods
1,157
DataExternalizer<ClassRepr> (final DependencyContext context) { return new DataExternalizer<>() { @Override public void save(final @NotNull DataOutput out, final ClassRepr value) { value.save(out); } @Override public ClassRepr read(final @NotNull DataInput in) { return new ClassRepr(context, in); } }; }
externalizer
1,158
void (final @NotNull DataOutput out, final ClassRepr value) { value.save(out); }
save
1,159
ClassRepr (final @NotNull DataInput in) { return new ClassRepr(context, in); }
read
1,160
void (final DependencyContext context, final PrintStream stream) { super.toStream(context, stream); stream.print(" Superclass : "); stream.println(mySuperClass.getDescr(context)); stream.print(" Interfaces : "); final TypeRepr.AbstractType[] is = myInterfaces.toArray(TypeRepr.AbstractType.EMPTY_TYPE_ARRAY); Arrays.sort(is, Comparator.comparing(o -> o.getDescr(context))); for (final TypeRepr.AbstractType t : is) { stream.print(t.getDescr(context)); stream.print(" "); } stream.println(); stream.print(" Targets : "); final ElemType[] es = myAnnotationTargets.toArray(new ElemType[0]); Arrays.sort(es); for (final ElemType e : es) { stream.print(e); stream.print("; "); } stream.println(); stream.print(" Policy : "); stream.println(myRetentionPolicy); stream.print(" Outer class: "); stream.println(context.getValue(myOuterClassName)); stream.print(" Local class: "); stream.println(myIsLocal); stream.print(" Anonymous class: "); stream.println(myIsAnonymous); stream.print(" Has inlined constants: "); stream.println(myHasInlinedConstants); stream.print(" IsGenerated: "); stream.println(myIsGenerated); stream.println(" Fields:"); final FieldRepr[] fs = myFields.toArray(new FieldRepr[0]); Arrays.sort(fs, (o1, o2) -> { if (o1.name == o2.name) { return o1.myType.getDescr(context).compareTo(o2.myType.getDescr(context)); } return Objects.requireNonNull(context.getValue(o1.name)).compareTo(Objects.requireNonNull(context.getValue(o2.name))); }); for (final FieldRepr f : fs) { f.toStream(context, stream); } stream.println(" End Of Fields"); stream.println(" Methods:"); final MethodRepr[] ms = myMethods.toArray(new MethodRepr[0]); Arrays.sort(ms, (o1, o2) -> { if (o1.name == o2.name) { final String d1 = o1.myType.getDescr(context); final String d2 = o2.myType.getDescr(context); final int c = d1.compareTo(d2); if (c == 0) { final int l1 = o1.myArgumentTypes.length; final int l2 = o2.myArgumentTypes.length; if (l1 == l2) { for (int i = 0; i<l1; i++) { final String d11 = o1.myArgumentTypes[i].getDescr(context); final String d22 = o2.myArgumentTypes[i].getDescr(context); final int cc = d11.compareTo(d22); if (cc != 0) { return cc; } } return 0; } return l1 -l2; } return c; } return Objects.requireNonNull(context.getValue(o1.name)).compareTo(Objects.requireNonNull(context.getValue(o2.name))); }); for (final MethodRepr m : ms) { m.toStream(context, stream); } stream.println(" End Of Methods"); stream.println(" Usages:"); final List<String> usages = new LinkedList<>(); for (final UsageRepr.Usage u : getUsages()) { final ByteArrayOutputStream bas = new ByteArrayOutputStream(); u.toStream(myContext, new PrintStream(bas)); try { bas.close(); } catch (final IOException e) { throw new BuildDataCorruptedException(e); } usages.add(bas.toString()); } Collections.sort(usages); for (final String s : usages) { stream.println(s); } stream.println(" End Of Usages"); }
toStream
1,161
boolean (final int key) { return myMap.containsKey(key); }
containsKey
1,162
IntSet (final int key) { return myMap.get(key); }
get
1,163
void (IntIntMultiMaplet m) { m.forEachEntry((integers, value) -> put(value, integers)); }
putAll
1,164
void (final int key, final IntSet value) { final IntSet x = myMap.get(key); if (x == null) { myMap.put(key, value); } else { x.addAll(value); } }
put
1,165
void (int key, IntSet value) { if (value == null || value.isEmpty()) { myMap.remove(key); } else { myMap.put(key, value); } }
replace
1,166
void (final int key, final int value) { final IntSet collection = myMap.get(key); if (collection == null) { final IntSet x = new IntOpenHashSet(); x.add(value); myMap.put(key, x); } else { collection.add(value); } }
put
1,167
void (final int key, final int value) { final IntSet collection = myMap.get(key); if (collection != null) { if (collection.remove(value)) { if (collection.isEmpty()) { myMap.remove(key); } } } }
removeFrom
1,168
void (int key, IntSet values) { final IntSet collection = myMap.get(key); if (collection != null) { collection.removeAll(values); if (collection.isEmpty()) { myMap.remove(key); } } }
removeAll
1,169
void (final int key) { myMap.remove(key); }
remove
1,170
void (IntIntMultiMaplet m) { m.forEachEntry((integers, value) -> replace(value, integers)); }
replaceAll
1,171
void () { myMap.clear(); // free memory }
close
1,172
void (boolean memoryCachesOnly) { }
flush
1,173
void (final DependencyContext context, final PrintStream stream) { kindToStream(stream); stream.println(" Name : " + context.getValue(myName)); stream.println(" Owner: " + context.getValue(myOwner)); }
toStream
1,174
int () { return myOwner; }
getOwner
1,175
void (final byte tag, final DataOutput out) { try { out.writeByte(tag); DataInputOutputUtil.writeINT(out, myName); DataInputOutputUtil.writeINT(out, myOwner); } catch (IOException e) { throw new BuildDataCorruptedException(e); } }
save
1,176
boolean (final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FMUsage fmUsage = (FMUsage)o; if (myName != fmUsage.myName) return false; if (myOwner != fmUsage.myOwner) return false; return true; }
equals
1,177
int () { return 31 * myName + myOwner; }
hashCode
1,178
void (final PrintStream stream) { stream.println("FieldUsage:"); }
kindToStream
1,179
void (final DependencyContext context, final PrintStream stream) { super.toStream(context, stream); stream.println(" Type: " + myType.getDescr(context)); }
toStream
1,180
void (final DataOutput out) { save(FIELD_USAGE, out); myType.save(out); }
save
1,181
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final FieldUsage that = (FieldUsage)o; return myType.equals(that.myType) && myName == that.myName && myOwner == that.myOwner; }
equals
1,182
int () { return 31 * (31 * myType.hashCode() + myName) + myOwner; }
hashCode
1,183
void (final PrintStream stream) { stream.println("FieldAssignUsage:"); }
kindToStream
1,184
void (final DataOutput out) { save(FIELD_ASSIGN_USAGE, out); myType.save(out); }
save
1,185
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final FieldAssignUsage that = (FieldAssignUsage)o; return myType.equals(that.myType) && myName == that.myName && myOwner == that.myOwner; }
equals
1,186
int () { return super.hashCode() + 1; }
hashCode
1,187
void (final DataOutput out) { save(METHOD_USAGE, out); RW.save(myArgumentTypes, out); myReturnType.save(out); }
save
1,188
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final MethodUsage that = (MethodUsage)o; if (myReturnType != null ? !myReturnType.equals(that.myReturnType) : that.myReturnType != null) return false; if (myName != that.myName) return false; if (myOwner != that.myOwner) return false; return Arrays.equals(myArgumentTypes, that.myArgumentTypes); }
equals
1,189
int () { return ((31 * Arrays.hashCode(myArgumentTypes) + (myReturnType.hashCode())) * 31 + (myName)) * 31 + (myOwner); }
hashCode
1,190
void (DependencyContext context, PrintStream stream) { super.toStream(context, stream); stream.println(" Arguments:"); for (final TypeRepr.AbstractType at : myArgumentTypes) { stream.println(" " + at.getDescr(context)); } stream.println(" Return type:"); stream.println(" " + myReturnType.getDescr(context)); }
toStream
1,191
void (final DataOutput out) { save(METAMETHOD_USAGE, out); }
save
1,192
void (final DataOutput out) { save(IMPORT_STATIC_MEMBER_USAGE, out); }
save
1,193
int () { return myClassName; }
getOwner
1,194
void (final DataOutput out) { try { out.writeByte(CLASS_USAGE); DataInputOutputUtil.writeINT(out, myClassName); } catch (IOException e) { throw new BuildDataCorruptedException(e); } }
save
1,195
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final ClassUsage that = (ClassUsage)o; return myClassName == that.myClassName; }
equals
1,196
int () { return myClassName; }
hashCode
1,197
void (final DependencyContext context, final PrintStream stream) { stream.println("ClassUsage: " + context.getValue(myClassName)); }
toStream
1,198
int () { return myModuleName; }
getOwner
1,199
void (final DataOutput out) { try { out.writeByte(MODULE_USAGE); DataInputOutputUtil.writeINT(out, myModuleName); } catch (IOException e) { throw new BuildDataCorruptedException(e); } }
save