"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/java/edu/umd/cs/findbugs/detect/UnreadFields.java" between
findbugs-3.0.0-source.zip and findbugs-3.0.1-source.zip

About: FindBugs uses static analysis to look for bugs in Java code. Source.

UnreadFields.java  (findbugs-3.0.0-source):UnreadFields.java  (findbugs-3.0.1-source)
skipping to change at line 207 skipping to change at line 207
if (getSuperclassName().indexOf('$') >= 0 || getSuperclassName().indexOf ('+') >= 0 if (getSuperclassName().indexOf('$') >= 0 || getSuperclassName().indexOf ('+') >= 0
|| withinAnonymousClass.matcher(getDottedClassName()).find()) { || withinAnonymousClass.matcher(getDottedClassName()).find()) {
// System.out.println("hicfsc: " + betterClassName); // System.out.println("hicfsc: " + betterClassName);
data.innerClassCannotBeStatic.add(getDottedClassName()); data.innerClassCannotBeStatic.add(getDottedClassName());
// System.out.println("hicfsc: " + betterSuperclassName); // System.out.println("hicfsc: " + betterSuperclassName);
data.innerClassCannotBeStatic.add(getDottedSuperclassName()); data.innerClassCannotBeStatic.add(getDottedSuperclassName());
} }
// Does this class directly implement Serializable? // Does this class directly implement Serializable?
String[] interface_names = obj.getInterfaceNames(); String[] interface_names = obj.getInterfaceNames();
for (String interface_name : interface_names) { for (String interface_name : interface_names) {
if (interface_name.equals("java.io.Externalizable")) { if ("java.io.Externalizable".equals(interface_name)) {
isSerializable = true; isSerializable = true;
} else if (interface_name.equals("java.io.Serializable")) { } else if ("java.io.Serializable".equals(interface_name)) {
isSerializable = true; isSerializable = true;
break; break;
} }
} }
// Does this class indirectly implement Serializable? // Does this class indirectly implement Serializable?
if ((!superClassIsObject || interface_names.length > 0) && !isSerializab le) { if ((!superClassIsObject || interface_names.length > 0) && !isSerializab le) {
try { try {
Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().g etSubtypes2(); Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().g etSubtypes2();
ClassDescriptor desc = DescriptorFactory.createClassDescriptor(o bj); ClassDescriptor desc = DescriptorFactory.createClassDescriptor(o bj);
skipping to change at line 268 skipping to change at line 268
data.allMyFields.clear(); data.allMyFields.clear();
data.calledFromConstructors.clear(); data.calledFromConstructors.clear();
} }
@Override @Override
public void visit(Field obj) { public void visit(Field obj) {
super.visit(obj); super.visit(obj);
XField f = XFactory.createXField(this); XField f = XFactory.createXField(this);
data.allMyFields.add(f); data.allMyFields.add(f);
String signature = obj.getSignature(); String signature = obj.getSignature();
if (!getFieldName().equals("serialVersionUID")) { if (!"serialVersionUID".equals(getFieldName())) {
data.myFields.add(f); data.myFields.add(f);
if (obj.getName().equals("_jspx_dependants")) { if ("_jspx_dependants".equals(obj.getName())) {
data.containerFields.add(f); data.containerFields.add(f);
} }
} }
if (isSeleniumWebElement(signature)) { if (isSeleniumWebElement(signature)) {
data.containerFields.add(f); data.containerFields.add(f);
} }
} }
public static boolean isSeleniumWebElement(String signature) { public static boolean isSeleniumWebElement(String signature) {
return signature.equals("Lorg/openqa/selenium/RenderedWebElement;") return "Lorg/openqa/selenium/RenderedWebElement;".equals(signature)
|| signature.equals("Lorg/openqa/selenium/WebElement;"); || "Lorg/openqa/selenium/WebElement;".equals(signature);
} }
@Override @Override
public void visitAnnotation(String annotationClass, Map<String, ElementValue > map, boolean runtimeVisible) { public void visitAnnotation(String annotationClass, Map<String, ElementValue > map, boolean runtimeVisible) {
if (!visitingField()) { if (!visitingField()) {
return; return;
} }
if (isInjectionAttribute(annotationClass)) { if (isInjectionAttribute(annotationClass)) {
data.containerFields.add(XFactory.createXField(this)); data.containerFields.add(XFactory.createXField(this));
} }
if (!annotationClass.startsWith("edu.umd.cs.findbugs") && !annotationCla ss.startsWith("javax.lang")) { if (!annotationClass.startsWith("edu.umd.cs.findbugs") && !annotationCla ss.startsWith("javax.lang")) {
data.unknownAnnotation.add(XFactory.createXField(this), annotationCl ass); data.unknownAnnotation.add(XFactory.createXField(this), annotationCl ass);
} }
} }
public static boolean isInjectionAttribute(@DottedClassName String annotatio nClass) { public static boolean isInjectionAttribute(@DottedClassName String annotatio nClass) {
if (annotationClass.startsWith("javax.annotation.") if (annotationClass.startsWith("javax.annotation.")
|| annotationClass.startsWith("javax.ejb") || annotationClass.startsWith("javax.ejb")
|| annotationClass.equals("org.apache.tapestry5.annotations.Pers || "org.apache.tapestry5.annotations.Persist".equals(annotationC
ist") lass)
|| annotationClass.equals("org.jboss.seam.annotations.In") || "org.jboss.seam.annotations.In".equals(annotationClass)
|| annotationClass.startsWith("javax.persistence") || annotationClass.startsWith("javax.persistence")
|| annotationClass.endsWith("SpringBean") || annotationClass.endsWith("SpringBean")
|| annotationClass.equals("com.google.inject.Inject") || "com.google.inject.Inject".equals(annotationClass)
|| annotationClass.startsWith("com.google.") && annotationClass. endsWith(".Bind") || annotationClass.startsWith("com.google.") && annotationClass. endsWith(".Bind")
&& annotationClass.hashCode() == -243168318 && annotationClass.hashCode() == -243168318
|| annotationClass.startsWith("org.nuxeo.common.xmap.annotation" ) || annotationClass.startsWith("org.nuxeo.common.xmap.annotation" )
|| annotationClass.startsWith("com.google.gwt.uibinder.client") || annotationClass.startsWith("com.google.gwt.uibinder.client")
|| annotationClass.startsWith("org.springframework.beans.factory .annotation") || annotationClass.startsWith("org.springframework.beans.factory .annotation")
|| annotationClass.equals("javax.ws.rs.core.Context")) { || "javax.ws.rs.core.Context".equals(annotationClass)) {
return true; return true;
} }
int lastDot = annotationClass.lastIndexOf('.'); int lastDot = annotationClass.lastIndexOf('.');
String lastPart = annotationClass.substring(lastDot + 1); String lastPart = annotationClass.substring(lastDot + 1);
if (lastPart.startsWith("Inject")) { if (lastPart.startsWith("Inject")) {
return true; return true;
} }
return false; return false;
} }
@Override @Override
public void visit(ConstantValue obj) { public void visit(ConstantValue obj) {
// ConstantValue is an attribute of a field, so the instance variables // ConstantValue is an attribute of a field, so the instance variables
// set during visitation of the Field are still valid here // set during visitation of the Field are still valid here
XField f = XFactory.createXField(this); XField f = XFactory.createXField(this);
data.constantFields.add(f); data.constantFields.add(f);
data.writtenFields.add(f);
} }
int count_aload_1; int count_aload_1;
private int previousOpcode; private int previousOpcode;
private int previousPreviousOpcode; private int previousPreviousOpcode;
@Override @Override
public void visit(Code obj) { public void visit(Code obj) {
count_aload_1 = 0; count_aload_1 = 0;
previousOpcode = -1; previousOpcode = -1;
previousPreviousOpcode = -1; previousPreviousOpcode = -1;
data.nullTested.clear(); data.nullTested.clear();
seenInvokeStatic = false; seenInvokeStatic = false;
seenMonitorEnter = getMethod().isSynchronized(); seenMonitorEnter = getMethod().isSynchronized();
data.staticFieldsReadInThisMethod.clear(); data.staticFieldsReadInThisMethod.clear();
super.visit(obj); super.visit(obj);
if (getMethodName().equals("<init>") && count_aload_1 > 1 if ("<init>".equals(getMethodName()) && count_aload_1 > 1
&& (getClassName().indexOf('$') >= 0 || getClassName().indexOf(' +') >= 0)) { && (getClassName().indexOf('$') >= 0 || getClassName().indexOf(' +') >= 0)) {
data.needsOuterObjectInConstructor.add(getDottedClassName()); data.needsOuterObjectInConstructor.add(getDottedClassName());
// System.out.println(betterClassName + // System.out.println(betterClassName +
// " needs outer object in constructor"); // " needs outer object in constructor");
} }
bugAccumulator.reportAccumulatedBugs(); bugAccumulator.reportAccumulatedBugs();
} }
@Override @Override
public void visit(Method obj) { public void visit(Method obj) {
if (DEBUG) { if (DEBUG) {
System.out.println("Checking " + getClassName() + "." + obj.getName( )); System.out.println("Checking " + getClassName() + "." + obj.getName( ));
} }
if (getMethodName().equals("<init>") && (obj.isPublic() || obj.isProtect ed())) { if ("<init>".equals(getMethodName()) && (obj.isPublic() || obj.isProtect ed())) {
publicOrProtectedConstructor = true; publicOrProtectedConstructor = true;
} }
pendingGetField = null; pendingGetField = null;
saState = 0; saState = 0;
super.visit(obj); super.visit(obj);
int flags = obj.getAccessFlags(); int flags = obj.getAccessFlags();
if ((flags & ACC_NATIVE) != 0) { if ((flags & ACC_NATIVE) != 0) {
hasNativeMethods = true; hasNativeMethods = true;
} }
} }
skipping to change at line 436 skipping to change at line 437
selfAssignment = true; selfAssignment = true;
} else { } else {
data.readFields.add(pendingGetField); data.readFields.add(pendingGetField);
} }
pendingGetField = null; pendingGetField = null;
} }
if (saState == 4) { if (saState == 4) {
saState = 0; saState = 0;
} }
if (seen == INVOKESTATIC && getClassConstantOperand().equals("java/util/ if (seen == INVOKESTATIC && "java/util/concurrent/atomic/AtomicReference
concurrent/atomic/AtomicReferenceFieldUpdater") FieldUpdater".equals(getClassConstantOperand())
&& getNameConstantOperand().equals("newUpdater")) { && "newUpdater".equals(getNameConstantOperand())) {
String fieldName = (String) stack.getStackItem(0).getConstant(); String fieldName = (String) stack.getStackItem(0).getConstant();
String fieldSignature = (String) stack.getStackItem(1).getConstant() ; String fieldSignature = (String) stack.getStackItem(1).getConstant() ;
String fieldClass = (String) stack.getStackItem(2).getConstant(); String fieldClass = (String) stack.getStackItem(2).getConstant();
if (fieldName != null && fieldSignature != null && fieldClass != nul l) { if (fieldName != null && fieldSignature != null && fieldClass != nul l) {
XField f = XFactory.createXField(fieldClass.replace('/', '.'), f ieldName, ClassName.toSignature(fieldSignature), XField f = XFactory.createXField(fieldClass.replace('/', '.'), f ieldName, ClassName.toSignature(fieldSignature),
false); false);
data.reflectiveFields.add(f); data.reflectiveFields.add(f);
} }
} }
if (seen == INVOKESTATIC && getClassConstantOperand().equals("java/util/ if (seen == INVOKESTATIC && "java/util/concurrent/atomic/AtomicIntegerFi
concurrent/atomic/AtomicIntegerFieldUpdater") eldUpdater".equals(getClassConstantOperand())
&& getNameConstantOperand().equals("newUpdater")) { && "newUpdater".equals(getNameConstantOperand())) {
String fieldName = (String) stack.getStackItem(0).getConstant(); String fieldName = (String) stack.getStackItem(0).getConstant();
String fieldClass = (String) stack.getStackItem(1).getConstant(); String fieldClass = (String) stack.getStackItem(1).getConstant();
if (fieldName != null && fieldClass != null) { if (fieldName != null && fieldClass != null) {
XField f = XFactory.createXField(fieldClass.replace('/', '.'), f ieldName, "I", false); XField f = XFactory.createXField(fieldClass.replace('/', '.'), f ieldName, "I", false);
data.reflectiveFields.add(f); data.reflectiveFields.add(f);
} }
} }
if (seen == INVOKESTATIC && getClassConstantOperand().equals("java/util/ if (seen == INVOKESTATIC && "java/util/concurrent/atomic/AtomicLongField
concurrent/atomic/AtomicLongFieldUpdater") Updater".equals(getClassConstantOperand())
&& getNameConstantOperand().equals("newUpdater")) { && "newUpdater".equals(getNameConstantOperand())) {
String fieldName = (String) stack.getStackItem(0).getConstant(); String fieldName = (String) stack.getStackItem(0).getConstant();
String fieldClass = (String) stack.getStackItem(1).getConstant(); String fieldClass = (String) stack.getStackItem(1).getConstant();
if (fieldName != null && fieldClass != null) { if (fieldName != null && fieldClass != null) {
XField f = XFactory.createXField(fieldClass.replace('/', '.'), f ieldName, "J", false); XField f = XFactory.createXField(fieldClass.replace('/', '.'), f ieldName, "J", false);
data.reflectiveFields.add(f); data.reflectiveFields.add(f);
} }
} }
if (seen == GETSTATIC) { if (seen == GETSTATIC) {
skipping to change at line 534 skipping to change at line 535
if (getThisClass().isPrivate() || getMethod().isPrivate()) { if (getThisClass().isPrivate() || getMethod().isPrivate()) {
priority++; priority++;
} }
if (getClassName().indexOf('$') != -1 || BCELUtil.isSynthetic(ge tMethod()) || f.isSynthetic() if (getClassName().indexOf('$') != -1 || BCELUtil.isSynthetic(ge tMethod()) || f.isSynthetic()
|| f.getName().indexOf('$') >= 0) { || f.getName().indexOf('$') >= 0) {
priority++; priority++;
} }
// Decrease priority for boolean fields used to control // Decrease priority for boolean fields used to control
// debug/test settings // debug/test settings
if (f.getName().indexOf("DEBUG") >= 0 || f.getName().indexOf("VE RBOSE") >= 0 && f.getSignature().equals("Z")) { if (f.getName().indexOf("DEBUG") >= 0 || f.getName().indexOf("VE RBOSE") >= 0 && "Z".equals(f.getSignature())) {
priority++; priority++;
priority++; priority++;
} }
// Eclipse bundles which implements start/stop *very* often // Eclipse bundles which implements start/stop *very* often
// assigns static instances there // assigns static instances there
if ((getMethodName().equals("start") || getMethodName().equals(" if (("start".equals(getMethodName()) || "stop".equals(getMethodN
stop")) ame()))
&& getMethodSig().equals("(Lorg/osgi/framework/BundleCon && "(Lorg/osgi/framework/BundleContext;)V".equals(getMet
text;)V")) { hodSig())) {
try { try {
JavaClass bundleClass = Repository.lookupClass("org.osgi .framework.BundleActivator"); JavaClass bundleClass = Repository.lookupClass("org.osgi .framework.BundleActivator");
if (getThisClass().instanceOf(bundleClass)) { if (getThisClass().instanceOf(bundleClass)) {
priority++; priority++;
} }
if (f.isReferenceType()) { if (f.isReferenceType()) {
FieldDescriptor fieldInfo = f.getFieldDescriptor(); FieldDescriptor fieldInfo = f.getFieldDescriptor();
String dottedClass = DeepSubtypeAnalysis.getComponen tClass(fieldInfo.getSignature()); String dottedClass = DeepSubtypeAnalysis.getComponen tClass(fieldInfo.getSignature());
JavaClass fieldClass = Repository.lookupClass(dotted Class); JavaClass fieldClass = Repository.lookupClass(dotted Class);
if (fieldClass != null && fieldClass.instanceOf(bund leClass)) { if (fieldClass != null && fieldClass.instanceOf(bund leClass)) {
skipping to change at line 576 skipping to change at line 577
.addClassAndMethod(this).addField(f), this); .addClassAndMethod(this).addField(f), this);
} }
} }
if (seen == INVOKEVIRTUAL || seen == INVOKEINTERFACE || seen == INVOKESP ECIAL || seen == INVOKESTATIC) { if (seen == INVOKEVIRTUAL || seen == INVOKEINTERFACE || seen == INVOKESP ECIAL || seen == INVOKESTATIC) {
String sig = getSigConstantOperand(); String sig = getSigConstantOperand();
String invokedClassName = getClassConstantOperand(); String invokedClassName = getClassConstantOperand();
if (invokedClassName.equals(getClassName()) if (invokedClassName.equals(getClassName())
&& (getMethodName().equals("<init>") || getMethodName().equa ls("<clinit>"))) { && ("<init>".equals(getMethodName()) || "<clinit>".equals(ge tMethodName()))) {
data.calledFromConstructors.add(getNameConstantOperand() + ":" + sig); data.calledFromConstructors.add(getNameConstantOperand() + ":" + sig);
} }
int pos = PreorderVisitor.getNumberArguments(sig); int pos = PreorderVisitor.getNumberArguments(sig);
if (stack.getStackDepth() > pos) { if (stack.getStackDepth() > pos) {
OpcodeStack.Item item = stack.getStackItem(pos); OpcodeStack.Item item = stack.getStackItem(pos);
boolean superCall = seen == INVOKESPECIAL && !invokedClassName.e quals(getClassName()); boolean superCall = seen == INVOKESPECIAL && !invokedClassName.e quals(getClassName());
if (DEBUG) { if (DEBUG) {
System.out.println("In " + getFullyQualifiedMethodName() + " saw call on " + item); System.out.println("In " + getFullyQualifiedMethodName() + " saw call on " + item);
} }
boolean selfCall = item.getRegisterNumber() == 0 && !superCall; boolean selfCall = item.getRegisterNumber() == 0 && !superCall;
if (selfCall && getMethodName().equals("<init>")) { if (selfCall && "<init>".equals(getMethodName())) {
sawSelfCallInConstructor = true; sawSelfCallInConstructor = true;
if (DEBUG) { if (DEBUG) {
System.out.println("Saw self call in " + getFullyQualifi edMethodName() + " to " + invokedClassName + "." System.out.println("Saw self call in " + getFullyQualifi edMethodName() + " to " + invokedClassName + "."
+ getNameConstantOperand()); + getNameConstantOperand());
} }
} }
} }
} }
if ((seen == IFNULL || seen == IFNONNULL) && stack.getStackDepth() > 0) { if ((seen == IFNULL || seen == IFNONNULL) && stack.getStackDepth() > 0) {
skipping to change at line 676 skipping to change at line 677
.contains(f))) { .contains(f))) {
try { try {
IsNullValueDataflow invDataflow = getClassContext().getI sNullValueDataflow(getMethod()); IsNullValueDataflow invDataflow = getClassContext().getI sNullValueDataflow(getMethod());
IsNullValueFrame iFrame = invDataflow.getAnalysis().getF actBeforeExceptionCheck(invDataflow.getCFG(), IsNullValueFrame iFrame = invDataflow.getAnalysis().getF actBeforeExceptionCheck(invDataflow.getCFG(),
getPC()); getPC());
if (!iFrame.isValid() || iFrame.getStackValue(pos).isDef initelyNotNull()) { if (!iFrame.isValid() || iFrame.getStackValue(pos).isDef initelyNotNull()) {
break computePlacesAssumedNonnull; break computePlacesAssumedNonnull;
} }
} catch (CheckedAnalysisException e) { } catch (CheckedAnalysisException e) {
AnalysisContext.logError("foo", e); AnalysisContext.logError("INV dataflow error when analyz ing "+getMethodDescriptor(), e);
} }
if (DEBUG) { if (DEBUG) {
System.out.println("RRR: " + f + " " + data.nullTested.c ontains(f) + " " System.out.println("RRR: " + f + " " + data.nullTested.c ontains(f) + " "
+ data.writtenInConstructorFields.contains(f) + " " + data.writtenNonNullFields.contains(f)); + data.writtenInConstructorFields.contains(f) + " " + data.writtenNonNullFields.contains(f));
} }
ProgramPoint p = new ProgramPoint(this); ProgramPoint p = new ProgramPoint(this);
Set<ProgramPoint> s = data.assumedNonNull.get(f); Set<ProgramPoint> s = data.assumedNonNull.get(f);
if (s == null) { if (s == null) {
s = Collections.singleton(p); s = Collections.singleton(p);
skipping to change at line 703 skipping to change at line 704
} }
} }
} }
} }
if (seen == ALOAD_1) { if (seen == ALOAD_1) {
count_aload_1++; count_aload_1++;
} else if (seen == GETFIELD || seen == GETSTATIC) { } else if (seen == GETFIELD || seen == GETSTATIC) {
XField f = XFactory.createReferencedXField(this); XField f = XFactory.createReferencedXField(this);
pendingGetField = f; pendingGetField = f;
if (getMethodName().equals("readResolve") && seen == GETFIELD) { if ("readResolve".equals(getMethodName()) && seen == GETFIELD) {
data.writtenFields.add(f); data.writtenFields.add(f);
data.writtenNonNullFields.add(f); data.writtenNonNullFields.add(f);
} }
if (DEBUG) { if (DEBUG) {
System.out.println("get: " + f); System.out.println("get: " + f);
} }
if (data.writtenFields.contains(f)) { if (data.writtenFields.contains(f)) {
data.fieldAccess.remove(f); data.fieldAccess.remove(f);
} else if (!data.fieldAccess.containsKey(f)) { } else if (!data.fieldAccess.containsKey(f)) {
data.fieldAccess.put(f, SourceLineAnnotation.fromVisitedInstruct ion(this)); data.fieldAccess.put(f, SourceLineAnnotation.fromVisitedInstruct ion(this));
skipping to change at line 741 skipping to change at line 742
} }
} else if (DEBUG) { } else if (DEBUG) {
System.out.println("put: " + f); System.out.println("put: " + f);
} }
if (writtingNonNull && data.readFields.contains(f)) { if (writtingNonNull && data.readFields.contains(f)) {
data.fieldAccess.remove(f); data.fieldAccess.remove(f);
} else if (!data.fieldAccess.containsKey(f)) { } else if (!data.fieldAccess.containsKey(f)) {
data.fieldAccess.put(f, SourceLineAnnotation.fromVisitedInstruct ion(this)); data.fieldAccess.put(f, SourceLineAnnotation.fromVisitedInstruct ion(this));
} }
boolean isConstructor = getMethodName().equals("<init>") || getMetho dName().equals("<clinit>"); boolean isConstructor = "<init>".equals(getMethodName()) || "<clinit >".equals(getMethodName());
if (getMethod().isStatic() == f.isStatic() if (getMethod().isStatic() == f.isStatic()
&& (isConstructor || data.calledFromConstructors.contains(ge tMethodName() + ":" + getMethodSig()) && (isConstructor || data.calledFromConstructors.contains(ge tMethodName() + ":" + getMethodSig())
|| getMethodName().equals("init") || getMethodName() || "init".equals(getMethodName()) || "init".equals(g
.equals("init") etMethodName())
|| getMethodName().equals("initialize") || getMethod || "initialize".equals(getMethodName()) || getMethod
().isPrivate())) { ().isPrivate())) {
if (isConstructor) { if (isConstructor) {
data.writtenInConstructorFields.add(f); data.writtenInConstructorFields.add(f);
if (f.getSignature().equals("Ljava/lang/ThreadLocal;") && it em != null && item.isNewlyAllocated()) { if ("Ljava/lang/ThreadLocal;".equals(f.getSignature()) && it em != null && item.isNewlyAllocated()) {
data.threadLocalAssignedInConstructor.put(f, new Program Point(this)); data.threadLocalAssignedInConstructor.put(f, new Program Point(this));
} }
} else { } else {
data.writtenInInitializationFields.add(f); data.writtenInInitializationFields.add(f);
} }
if (writtingNonNull) { if (writtingNonNull) {
data.assumedNonNull.remove(f); data.assumedNonNull.remove(f);
} }
} else { } else {
data.writtenOutsideOfInitializationFields.add(f); data.writtenOutsideOfInitializationFields.add(f);
skipping to change at line 1081 skipping to change at line 1082
XClass outerXClass = Global.getAnalysisCache().getClassAnaly sis(XClass.class, cDesc); XClass outerXClass = Global.getAnalysisCache().getClassAnaly sis(XClass.class, cDesc);
AnalysisContext analysisContext = AnalysisContext.currentAna lysisContext(); AnalysisContext analysisContext = AnalysisContext.currentAna lysisContext();
Subtypes2 subtypes2 = analysisContext.getSubtypes2(); Subtypes2 subtypes2 = analysisContext.getSubtypes2();
for (XField of : outerXClass.getXFields()) { for (XField of : outerXClass.getXFields()) {
if (!of.isStatic()) { if (!of.isStatic()) {
String sourceSignature = of.getSourceSignature(); String sourceSignature = of.getSourceSignature();
if (sourceSignature != null && of.getSignature().equ als("Ljava/lang/ThreadLocal;")) { if (sourceSignature != null && "Ljava/lang/ThreadLoc al;".equals(of.getSignature())) {
Type ofType = GenericUtilities.getType(sourceSig nature); Type ofType = GenericUtilities.getType(sourceSig nature);
if (ofType instanceof GenericObjectType) { if (ofType instanceof GenericObjectType) {
GenericObjectType gType = (GenericObjectType ) ofType; GenericObjectType gType = (GenericObjectType ) ofType;
for (ReferenceType r : gType.getParameters() ) { for (ReferenceType r : gType.getParameters() ) {
if (r instanceof ObjectType) { if (r instanceof ObjectType) {
ClassDescriptor c = DescriptorFactor y.getClassDescriptor((ObjectType) r); ClassDescriptor c = DescriptorFactor y.getClassDescriptor((ObjectType) r);
if (subtypes2.isSubtype(f.getClassDe scriptor(), c)) { if (subtypes2.isSubtype(f.getClassDe scriptor(), c)) {
ProgramPoint p = data.threadLoca lAssignedInConstructor.get(of); ProgramPoint p = data.threadLoca lAssignedInConstructor.get(of);
int priority = p == null ? NORMA L_PRIORITY : HIGH_PRIORITY; int priority = p == null ? NORMA L_PRIORITY : HIGH_PRIORITY;
skipping to change at line 1109 skipping to change at line 1110
} }
} }
} }
} }
} }
} }
boolean outerClassIsInnerClass = false; boolean outerClassIsInnerClass = false;
for (Field field : outerClass.getFields()) { for (Field field : outerClass.getFields()) {
if (field.getName().equals("this$0")) { if ("this$0".equals(field.getName())) {
outerClassIsInnerClass = true; outerClassIsInnerClass = true;
} }
} }
if (outerClassIsInnerClass) { if (outerClassIsInnerClass) {
continue; continue;
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
bugReporter.reportMissingClass(e); bugReporter.reportMissingClass(e);
} catch (CheckedAnalysisException e) { } catch (CheckedAnalysisException e) {
bugReporter.logError("Error getting outer XClass for " + out erClassName, e); bugReporter.logError("Error getting outer XClass for " + out erClassName, e);
 End of changes. 25 change blocks. 
39 lines changed or deleted 40 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS