Skip to content

Commit

Permalink
Don't fail if BCEL can't find system classes on Java 9
Browse files Browse the repository at this point in the history
This is a workaround for missing Java 9 system classes. Probably BCEL
update needed?
  • Loading branch information
iloveeclipse committed Jun 5, 2016
1 parent e4b9122 commit db8203c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions findbugs/src/java/edu/umd/cs/findbugs/ba/AnalysisContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

import net.jcip.annotations.NotThreadSafe;

import org.apache.bcel.Repository;
import org.apache.bcel.classfile.JavaClass;

Expand Down Expand Up @@ -70,6 +68,7 @@
import edu.umd.cs.findbugs.detect.UnreadFieldsData;
import edu.umd.cs.findbugs.internalAnnotations.DottedClassName;
import edu.umd.cs.findbugs.util.ClassName;
import net.jcip.annotations.NotThreadSafe;

/**
* A context for analysis of a complete project. This serves as the repository
Expand Down Expand Up @@ -542,7 +541,12 @@ public static JavaClass lookupSystemClass(@Nonnull String className) throws Clas
}

JavaClass clazz = originalRepository.findClass(className);
return (clazz == null ? originalRepository.loadClass(className) : clazz);
if(clazz != null){
return clazz;
}
// XXX workaround for system classes missing on Java 9
// Not sure if we BCEL update, but this seem to work in simple cases
return AnalysisContext.currentAnalysisContext().lookupClass(className);

This comment has been minimized.

Copy link
@iloveeclipse

iloveeclipse Jun 5, 2016

Author Member

@amaembo : WDYT? BCEL issue?

}

/**
Expand Down

0 comments on commit db8203c

Please sign in to comment.