LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File findbugs-bcel.patch of Package findbugs (Project Java:packages)

Index: findbugs-1.3.9/src/java/edu/umd/cs/findbugs/visitclass/BetterVisitor.java
===================================================================
--- findbugs-1.3.9.orig/src/java/edu/umd/cs/findbugs/visitclass/BetterVisitor.java	2010-01-27 10:44:28.427709742 +0100
+++ findbugs-1.3.9/src/java/edu/umd/cs/findbugs/visitclass/BetterVisitor.java	2010-01-27 10:44:39.101709879 +0100
@@ -39,6 +39,7 @@
 import org.apache.bcel.classfile.ConstantString;
 import org.apache.bcel.classfile.ConstantUtf8;
 import org.apache.bcel.classfile.ConstantValue;
+import org.apache.bcel.classfile.EmptyVisitor;
 import org.apache.bcel.classfile.ExceptionTable;
 import org.apache.bcel.classfile.Field;
 import org.apache.bcel.classfile.InnerClass;
@@ -56,7 +57,6 @@
 import org.apache.bcel.classfile.StackMapEntry;
 import org.apache.bcel.classfile.Synthetic;
 import org.apache.bcel.classfile.Unknown;
-import org.apache.bcel.classfile.Visitor;
 
 
 /**
@@ -65,7 +65,7 @@
  * @author <A HREF="http://www.cs.umd.edu/~pugh">William Pugh</A>
  * @version 980818
  */
-public abstract class BetterVisitor implements Visitor {
+public abstract class BetterVisitor extends EmptyVisitor {
 
 
 	/** clone() is overridden to change access control from protected
Index: findbugs-1.3.9/src/java/edu/umd/cs/findbugs/ba/type/TypeAnalysis.java
===================================================================
--- findbugs-1.3.9.orig/src/java/edu/umd/cs/findbugs/ba/type/TypeAnalysis.java	2010-01-27 10:44:28.427709742 +0100
+++ findbugs-1.3.9/src/java/edu/umd/cs/findbugs/ba/type/TypeAnalysis.java	2010-01-27 10:44:39.102710256 +0100
@@ -198,7 +198,8 @@
 		for(Attribute a : code.getAttributes()) {
 			if (a instanceof LocalVariableTypeTable) {
 				typeTable = (LocalVariableTypeTable) a;
-				for (LocalVariable v : typeTable.getLocalVariableTable()) {
+				for (int i = 0; i < typeTable.getTableLength(); i++) {
+					LocalVariable v = typeTable.getLocalVariable(i);
 					int startPC = v.getStartPC();
 					if (startPC >= 0) startOfLocalTypedVariables.set(startPC);
 				}
@@ -372,7 +373,8 @@
 		if (typeTable != null) {
 			int pos = handle.getPosition();
 			if (pos >= 0 && startOfLocalTypedVariables.get(pos))
-			for(LocalVariable local : typeTable.getLocalVariableTable()) {
+				for (int i = 0; i < typeTable.getTableLength(); i++) {
+				LocalVariable local = typeTable.getLocalVariable(i);
 				if (local.getStartPC() == pos) {
 					String signature = local.getSignature();
 					Type t;
Index: findbugs-1.3.9/src/java/edu/umd/cs/findbugs/ba/obl/ObligationFactory.java
===================================================================
--- findbugs-1.3.9.orig/src/java/edu/umd/cs/findbugs/ba/obl/ObligationFactory.java	2010-01-27 10:44:28.428709849 +0100
+++ findbugs-1.3.9/src/java/edu/umd/cs/findbugs/ba/obl/ObligationFactory.java	2010-01-27 10:44:39.160717677 +0100
@@ -74,7 +74,7 @@
 	 */
 	public boolean isObligationType(ClassDescriptor classDescriptor) {
 		try {
-			return getObligationByType(ObjectType.getInstance(classDescriptor.toDottedClassName())) != null;
+			return getObligationByType(new ObjectType(classDescriptor.toDottedClassName())) != null;
 		} catch (ClassNotFoundException e) {
 			Global.getAnalysisCache().getErrorLogger().reportMissingClass(e);
 			return false;
@@ -124,7 +124,7 @@
 	 */
 	public @CheckForNull Obligation getObligationByType(ClassDescriptor classDescriptor) {
 		try {
-			return getObligationByType(ObjectType.getInstance(classDescriptor.toDottedClassName()));
+			return getObligationByType(new ObjectType(classDescriptor.toDottedClassName()));
 		} catch (ClassNotFoundException e) {
 			Global.getAnalysisCache().getErrorLogger().reportMissingClass(e);
 			return null;
Index: findbugs-1.3.9/src/java/edu/umd/cs/findbugs/util/SubtypeTypeMatcher.java
===================================================================
--- findbugs-1.3.9.orig/src/java/edu/umd/cs/findbugs/util/SubtypeTypeMatcher.java	2010-01-27 10:44:28.428709849 +0100
+++ findbugs-1.3.9/src/java/edu/umd/cs/findbugs/util/SubtypeTypeMatcher.java	2010-01-27 10:44:39.176833613 +0100
@@ -53,7 +53,7 @@
 	 *                  or not candidate Types are subtypes of the class
 	 */
 	public SubtypeTypeMatcher(ClassDescriptor classDescriptor) {
-		this(ObjectType.getInstance(classDescriptor.toDottedClassName()));
+		this(new ObjectType(classDescriptor.toDottedClassName()));
 	}
 
 	public boolean matches(Type t) {
Index: findbugs-1.3.9/src/java/edu/umd/cs/findbugs/detect/BuildObligationPolicyDatabase.java
===================================================================
--- findbugs-1.3.9.orig/src/java/edu/umd/cs/findbugs/detect/BuildObligationPolicyDatabase.java	2010-01-27 10:44:28.428709849 +0100
+++ findbugs-1.3.9/src/java/edu/umd/cs/findbugs/detect/BuildObligationPolicyDatabase.java	2010-01-27 10:44:39.193729777 +0100
@@ -278,7 +278,7 @@
 		
 		Obligation javaIoInputStreamObligation = database.getFactory().getObligationByName("java.io.InputStream");
 		database.addEntry(new MatchMethodEntry(
-				new SubtypeTypeMatcher(ObjectType.getInstance("java.lang.Class")),
+				new SubtypeTypeMatcher(new ObjectType("java.lang.Class")),
 				new ExactStringMatcher("getResourceAsStream"),
 				new ExactStringMatcher("(Ljava/lang/String;)Ljava/io/InputStream;"),
 				false,
@@ -292,7 +292,7 @@
 		
 		// Add factory method entries for database obligation types
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.sql.DriverManager")),
+			new SubtypeTypeMatcher(new ObjectType("java.sql.DriverManager")),
 			new ExactStringMatcher("getConnection"),
 			new RegexStringMatcher("^.*\\)Ljava/sql/Connection;$"),
 			false,
@@ -300,7 +300,7 @@
 			ObligationPolicyDatabaseEntryType.STRONG,
 			connection));
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.sql.Connection")),
+			new SubtypeTypeMatcher(new ObjectType("java.sql.Connection")),
 			new ExactStringMatcher("createStatement"),
 			new RegexStringMatcher("^.*\\)Ljava/sql/Statement;$"),
 			false,
@@ -308,7 +308,7 @@
 			ObligationPolicyDatabaseEntryType.STRONG,
 			statement));
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.sql.Connection")),
+			new SubtypeTypeMatcher(new ObjectType("java.sql.Connection")),
 			new ExactStringMatcher("prepareStatement"),
 			new RegexStringMatcher("^.*\\)Ljava/sql/PreparedStatement;$"),
 			false,
@@ -316,7 +316,7 @@
 			ObligationPolicyDatabaseEntryType.STRONG,
 			statement));
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.sql.Statement")),
+			new SubtypeTypeMatcher(new ObjectType("java.sql.Statement")),
 			new ExactStringMatcher("executeQuery"),
 			new RegexStringMatcher("^.*\\)Ljava/sql/ResultSet;$"),
 			false,
@@ -326,7 +326,7 @@
 		
 		// Add close method entries for database obligation types
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.sql.Connection")),
+			new SubtypeTypeMatcher(new ObjectType("java.sql.Connection")),
 			new ExactStringMatcher("close"),
 			new ExactStringMatcher("()V"),
 			false,
@@ -334,7 +334,7 @@
 			ObligationPolicyDatabaseEntryType.STRONG,
 			connection));
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.sql.Statement")),
+			new SubtypeTypeMatcher(new ObjectType("java.sql.Statement")),
 			new ExactStringMatcher("close"),
 			new ExactStringMatcher("()V"),
 			false,
@@ -342,7 +342,7 @@
 			ObligationPolicyDatabaseEntryType.STRONG,
 			statement, resultSet));
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.sql.ResultSet")),
+			new SubtypeTypeMatcher(new ObjectType("java.sql.ResultSet")),
 			new ExactStringMatcher("close"),
 			new ExactStringMatcher("()V"),
 			false,
@@ -357,14 +357,14 @@
 	private void addFileStreamEntries(String kind) {
 		Obligation obligation = database.getFactory().addObligation("java.io." + kind);
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.io.File" + kind)),
+			new SubtypeTypeMatcher(new ObjectType("java.io.File" + kind)),
 			new ExactStringMatcher("<init>"),
 			new RegexStringMatcher(".*"),
 			false, ObligationPolicyDatabaseActionType.ADD,
 			ObligationPolicyDatabaseEntryType.STRONG,
 			obligation));
 		database.addEntry(new MatchMethodEntry(
-			new SubtypeTypeMatcher(ObjectType.getInstance("java.io." + kind)),
+			new SubtypeTypeMatcher(new ObjectType("java.io." + kind)),
 			new ExactStringMatcher("close"),
 			new ExactStringMatcher("()V"),
 			false,