You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/08/12 13:34:52 UTC

svn commit: r1695481 - in /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6: generic/ObjectType.java verifier/structurals/InstConstraintVisitor.java

Author: sebb
Date: Wed Aug 12 11:34:52 2015
New Revision: 1695481

URL: http://svn.apache.org/r1695481
Log:
BCEL-231 Remove deprecated methods and classes
(continued...)

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ObjectType.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/InstConstraintVisitor.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ObjectType.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ObjectType.java?rev=1695481&r1=1695480&r2=1695481&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ObjectType.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ObjectType.java Wed Aug 12 11:34:52 2015
@@ -70,42 +70,6 @@ public class ObjectType extends Referenc
 
 
     /**
-     * If "this" doesn't reference a class, it references an interface
-     * or a non-existant entity.
-     * @deprecated this method returns an inaccurate result
-     *   if the class or interface referenced cannot
-     *   be found: use referencesClassExact() instead
-     */
-    @Deprecated
-    public boolean referencesClass() {
-        try {
-            JavaClass jc = Repository.lookupClass(class_name);
-            return jc.isClass();
-        } catch (ClassNotFoundException e) {
-            return false;
-        }
-    }
-
-
-    /**
-     * If "this" doesn't reference an interface, it references a class
-     * or a non-existant entity.
-     * @deprecated this method returns an inaccurate result
-     *   if the class or interface referenced cannot
-     *   be found: use referencesInterfaceExact() instead
-     */
-    @Deprecated
-    public boolean referencesInterface() {
-        try {
-            JavaClass jc = Repository.lookupClass(class_name);
-            return !jc.isClass();
-        } catch (ClassNotFoundException e) {
-            return false;
-        }
-    }
-
-
-    /**
      * Return true if this type references a class,
      * false if it references an interface.
      * @return true if the type references a class, false if
@@ -139,7 +103,7 @@ public class ObjectType extends Referenc
      *  can't be found
      */
     public boolean subclassOf( ObjectType superclass ) throws ClassNotFoundException {
-        if (this.referencesInterface() || superclass.referencesInterface()) {
+        if (this.referencesInterfaceExact() || superclass.referencesInterfaceExact()) {
             return false;
         }
         return Repository.instanceOf(this.class_name, superclass.class_name);

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/InstConstraintVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/InstConstraintVisitor.java?rev=1695481&r1=1695480&r2=1695481&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/InstConstraintVisitor.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/InstConstraintVisitor.java Wed Aug 12 11:34:52 2015
@@ -2584,8 +2584,12 @@ public class InstConstraintVisitor exten
         ObjectType obj = (ObjectType) t;
 
         //e.g.: Don't instantiate interfaces
-        if (! obj.referencesClass()){
-            constraintViolated(o, "Expecting a class type (ObjectType) to work on. Found: '"+obj+"'.");
+        try {
+            if (! obj.referencesClassExact()){
+                constraintViolated(o, "Expecting a class type (ObjectType) to work on. Found: '"+obj+"'.");
+            }
+        } catch (ClassNotFoundException e) {
+            constraintViolated(o, "Expecting a class type (ObjectType) to work on. Found: '"+obj+"'." + " which threw " + e);
         }
     }