]> source.dussan.org Git - aspectj.git/commitdiff
Bring Java9 branch in line with 1.8.11 progress
authorAndy Clement <aclement@pivotal.io>
Thu, 21 Sep 2017 17:48:59 +0000 (10:48 -0700)
committerAndy Clement <aclement@pivotal.io>
Thu, 21 Sep 2017 17:48:59 +0000 (10:48 -0700)
13 files changed:
1  2 
ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java
lib/bcel/bcel-src.zip
lib/bcel/bcel-verifier-src.zip
lib/bcel/bcel-verifier.jar
lib/bcel/bcel.jar
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
org.eclipse.jdt.core/jdtcore-for-aspectj.jar
util/src/org/aspectj/util/LangUtil.java
weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java

index 42e8254ccdfd9160f25c07cbb308c7859cfe5d1f,6ee7f7a88ced182465746ec6dd43013799472897..144b4e478f6987b6d64db27ba611382cb33822d3
  import java.io.File;
  import java.util.List;
  
- import org.aspectj.util.FileUtil;
  import org.aspectj.util.LangUtil;
  
- //import com.sun.org.apache.xml.internal.serializer.utils.Utils;
--
  /**
   * A long way to go until full coverage, but this is the place to add more.
   * 
diff --cc lib/bcel/bcel-src.zip
index 867d115a43c63c3bed06515d4b8c340639425126,58136055bbc8790991d69d0e6604d41abdc827de..0000000000000000000000000000000000000000
deleted file mode 100644,100644
Binary files differ
diff --cc lib/bcel/bcel-verifier-src.zip
index 9d58d629cadd4c32d5be0f7363d9640a8660bfd4,c6a16a60b7a62a1b38130804577adc227213288e..0000000000000000000000000000000000000000
deleted file mode 100644,100644
Binary files differ
diff --cc lib/bcel/bcel-verifier.jar
index f2305a98ace2ab74052d7b2673c2ad8710094baa,05c04d096c44d1f52e8ebbdbd1e50b5a20b9b68a..0000000000000000000000000000000000000000
deleted file mode 100644,100644
Binary files differ
diff --cc lib/bcel/bcel.jar
index 6cc389190936f986995b4c03043f04918355c68f,fdfd8dedae8fcd6393accd25eea986c2525d6d09..0000000000000000000000000000000000000000
deleted file mode 100644,100644
Binary files differ
index e6e2cff5f6f1e0888ac3e5fa952435cad01c99e9,f59300075d693ed94b383e1c980c912bdece6505..afdc56f35338ee0db91931e6d6a58fe907cf8b4c
@@@ -4,11 -4,10 +4,11 @@@
       The -Xlintfile:lint.properties allows fine-grained control. In tools.jar, see
       org/aspectj/weaver/XlintDefault.properties for the default behavior and a template to copy. 
  ### AspectJ-specific messages 
 -compiler.name = AspectJ Compiler 1.8.10
 -compiler.version = Eclipse Compiler Neon.2 #75dbfad0, 3.12
 +compiler.name = AspectJ Compiler 1.9.0
- compiler.version = Eclipse Compiler BETA_JAVA9_3798415d74984, 3.13
++compiler.version = Eclipse Compiler BETA_JAVA9_062ac5d7a6bf9(Sep2017), 3.13
  compiler.copyright = 
  
 +
  ## this next one superceded by above...
  ## configure.version = AspectJ Compiler 1.1 
  
diff --cc org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
index 8780c1822f5529e7c3a91e02631fbcc936afa884,89aedd312669f0e2729ba476e85ebe1a672f1b7c..0000000000000000000000000000000000000000
deleted file mode 100644,100644
Binary files differ
diff --cc org.eclipse.jdt.core/jdtcore-for-aspectj.jar
index 0582957c4fe2850bdcf0ab2ed84e039706913490,7714061a606fa5bbb6f7653ad48cd249f76e1f98..0000000000000000000000000000000000000000
deleted file mode 100644,100644
Binary files differ
index cbde8e680d243e98347a42f44b70327a4920ef60,3dcbf45b2c1f2fde749805392c53b3521b786e40..2310ad0a9c380ad8b21fd22f9169c9b8fcbbbe92
   * ******************************************************************/
  package org.aspectj.weaver.reflect;
  
- import junit.framework.TestCase;
+ import java.lang.reflect.Method;
+ import java.lang.reflect.Type;
  
++<<<<<<< HEAD
 +import java.util.List;
 +
 +import org.aspectj.weaver.ResolvedType;
 +import org.aspectj.weaver.UnresolvedType;
 +import org.aspectj.weaver.World;
 +import org.aspectj.weaver.patterns.ConcreteCflowPointcut;
++=======
+ import org.aspectj.bridge.IMessageHandler;
+ import org.aspectj.weaver.ReferenceType;
+ import org.aspectj.weaver.ResolvedMember;
+ import org.aspectj.weaver.ResolvedType;
+ import org.aspectj.weaver.UnresolvedType;
+ import org.aspectj.weaver.World;
+ import org.aspectj.weaver.bcel.BcelWorld;
+ import junit.framework.TestCase;
++>>>>>>> master
  
  public class ReflectionWorldTest extends TestCase {
  
                assertEquals("void", UnresolvedType.VOID, world.resolve(void.class));
        }
        
 -
 +      static class AbstractSuperClass<A,B> {}
 +      static interface InterfaceOne {}
 +      static interface InterfaceTwo<A> {}
 +      static class ID {}
 +      static abstract class AbstractTestClass<T> extends AbstractSuperClass<T,ID> implements InterfaceOne, InterfaceTwo<T> {
 +
 +      }
 +      static class TestType {}
 +//    static class ConcreteClass extends AbstractTestClass<TestType> {
 +      static class ConcreteClass extends AbstractTestClass<List<TestType>> {
 +      }
 +      
 +      static class Bar extends ConcreteClass {}
 +      
 +      public void testGenerics() {
 +              ReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
 +//            world.lookupOrCreateName(UnresolvedType.forName(AbstractTestClass.class.getName()));
 +//            ResolvedType resolvedType = world.resolve(AbstractTestClass.class);
 +              JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(world);
 +              ResolvedType resolvedType2 = converter.fromType(ConcreteClass.class);
 +      }
 +
+       public void testTypeConversions_509327() throws Exception {
+               ReflectionWorld rWorld = new ReflectionWorld(getClass().getClassLoader());
+               JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(rWorld);
+               // Check basic conversion of String to String
+               Method method = TestClass.class.getDeclaredMethod("m");
+               Type stringType = method.getGenericReturnType();
+               assertEquals("java.lang.String",stringType.getTypeName());
+               ResolvedType stringResolvedType = converter.fromType(stringType);
+               assertEquals("java.lang.String",stringResolvedType.getName());
+               
+               // public String m() { return ""; }
+               method = TestClass2.class.getDeclaredMethod("m");
+               stringType = method.getGenericReturnType();
+               assertEquals("java.lang.String",stringType.getTypeName());
+               stringResolvedType = converter.fromType(stringType);
+               assertEquals("java.lang.String",stringResolvedType.getName());
+               
+               // Verify that the conversion process creates the same thing as the bcel unpacking
+               // Here the return type is a non-static inner of a generic class
+               // public Inner m2() { return null; }
+               method = TestClass2.class.getDeclaredMethod("m2");
+               Type innerType = method.getGenericReturnType();
+               assertEquals("org.aspectj.weaver.reflect.ReflectionWorldTest.org.aspectj.weaver.reflect.ReflectionWorldTest$TestClass2<T>.Inner",innerType.getTypeName());
+               ResolvedType rType_Inner = converter.fromType(innerType);
+               assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2$Inner;",rType_Inner.getSignature());
+               assertEquals(UnresolvedType.TypeKind.SIMPLE,rType_Inner.getTypekind());
+               ResolvedType rType_Outer = rType_Inner.getOuterClass();
+               assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2;",rType_Outer.getSignature());
+               
+               BcelWorld bWorld = new BcelWorld(getClass().getClassLoader(), IMessageHandler.THROW, null);
+               bWorld.setBehaveInJava5Way(true);
+               UnresolvedType javaUtilHashMap = UnresolvedType.forName("java.util.HashMap");
+               ReferenceType rawType = (ReferenceType) bWorld.resolve(javaUtilHashMap);
+               assertNotNull(rawType);
+               
+               // Now use bcel to resolve the same m2 method, and compare the signatures of the return types
+               ResolvedType bResolved_TestClass2 = bWorld.resolve(UnresolvedType.forName(TestClass2.class.getName()));
+               assertNotNull(bResolved_TestClass2);
+               ResolvedMember bMethod_m2 = findMethod(bResolved_TestClass2,"m2");
+               ResolvedType bType_Inner = (ResolvedType) bMethod_m2.getReturnType();
+               assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2$Inner;",bType_Inner.getSignature());
+               assertEquals(UnresolvedType.TypeKind.SIMPLE,bType_Inner.getTypekind());
+               ResolvedType bType_Outer = bType_Inner.getOuterClass();
+               assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2;",bType_Outer.getSignature());
+               assertEquals(bType_Inner.getSignature(),rType_Inner.getSignature());
+               assertEquals(bType_Outer.getSignature(),rType_Outer.getSignature());
+       }
+       
+       public void testTypeConversions_509327_2() throws Exception {
+               ReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+               JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(world);
+               BcelWorld bWorld = new BcelWorld(getClass().getClassLoader(), IMessageHandler.THROW, null);
+               bWorld.setBehaveInJava5Way(true);
+               
+               // Slightly more advanced, now the method is returning a parameterized form of the outer
+               // generic class
+               
+               // public TestClass2<String>.Inner m3() { return new TestClass2<String>.Inner("Foo"); }
+               Method method = TestClass2.class.getDeclaredMethod("m3");
+               Type type_ParameterizedInner = method.getGenericReturnType();
+               assertEquals("org.aspectj.weaver.reflect.ReflectionWorldTest.org.aspectj.weaver.reflect.ReflectionWorldTest$TestClass2<java.lang.String>.Inner",type_ParameterizedInner.getTypeName());
+               ResolvedType rType_ParameterizedInner = converter.fromType(type_ParameterizedInner);
+               // NOTE: DECLARED PARAMETERIZATION OF OUTER IS LOST
+               assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2$Inner;",rType_ParameterizedInner.getSignature());
+               ResolvedType bResolved_TestClass2 = bWorld.resolve(UnresolvedType.forName(TestClass2.class.getName()));
+               assertNotNull(bResolved_TestClass2);
+               ResolvedMember bMethod_m3 = findMethod(bResolved_TestClass2,"m3");
+               ResolvedType bType_Inner = (ResolvedType) bMethod_m3.getReturnType();
+               // NOTE: DECLARED PARAMETERIZATION OF OUTER IS LOST
+               assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2$Inner;",bType_Inner.getSignature());
+               assertEquals(UnresolvedType.TypeKind.SIMPLE,bType_Inner.getTypekind());
+               ResolvedType bType_Outer = bType_Inner.getOuterClass();
+                       
+               // Fields seem to lose it too, although the backinggenericmember has the info
+ //            ResolvedMember bField_f = findField(bResolved_TestClass2,"f");
+ //            ResolvedMember backingGenericMember = bField_f.getBackingGenericMember();
+ //            System.out.println(backingGenericMember);
+ //            System.out.println(backingGenericMember.getGenericReturnType());
+ //            System.out.println(bField_f);
+ //            System.out.println(bField_f.getSignature());
+ //            System.out.println(bField_f.getGenericReturnType());
+       }
+       
+ //    public void testbar() throws Exception {
+ //            ReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+ //            JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(world);
+ //            
+ //            // public TestClass2<String>.Inner m3() { return new TestClass2<String>.Inner("Foo"); }
+ //            Method method = TestClass2.class.getDeclaredMethod("m3");
+ //            Type type_ParameterizedInner = method.getGenericReturnType();
+ //            assertEquals("org.aspectj.weaver.reflect.ReflectionWorldTest.org.aspectj.weaver.reflect.ReflectionWorldTest$TestClass2<java.lang.String>.Inner",type_ParameterizedInner.getTypeName());
+ //            ResolvedType rType_ParameterizedInner = converter.fromType(type_ParameterizedInner);
+ //            System.out.println(rType_ParameterizedInner);   
+ //            System.out.println(type_ParameterizedInner.getTypeName());
+ //    }
+ //    
+ //    public void testfoo() {
+ //            ReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+ //            JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(world);
+ //            BcelWorld bWorld = new BcelWorld(getClass().getClassLoader(), IMessageHandler.THROW, null);
+ //            bWorld.setBehaveInJava5Way(true);
+ //            
+ //
+ //            ResolvedType bResolved_TestClass2 = bWorld.resolve(UnresolvedType.forName(TestClass2.class.getName()));
+ //            ResolvedMember bField_f = findField(bResolved_TestClass2,"f");          
+ //            System.out.println(bField_f);
+ //            System.out.println(bField_f.getGenericReturnType());
+ //            System.out.println(bField_f.getReturnType());
+ //            System.out.println(bField_f.getBackingGenericMember().getGenericReturnType());
+ //    }
+       static class TestClass {
+               public String m() { return ""; }
+       }
+       
+       static class TestClass2<T> {
+               class Inner {
+                       T t;
+                       Inner(T t) {
+                               this.t = t;
+                       }
+               }
+               public String m() { return ""; }
+               public Inner m2() { return null; }
+               public TestClass2<String> f;
+               public TestClass2<String>.Inner m3() { return new TestClass2<String>.Inner("Foo"); }
+       }
+       private ResolvedMember findMethod(ResolvedType resolvedType, String methodName) {
+               for (ResolvedMember method: resolvedType.getDeclaredMethods()) {
+                       if (method.getName().equals(methodName)) {
+                               return method;
+                       }
+               }
+               return null;
+       }
+       
+       private ResolvedMember findField(ResolvedType resolvedType, String fieldName) {
+               for (ResolvedMember field: resolvedType.getDeclaredFields()) {
+                       if (field.getName().equals(fieldName)) {
+                               return field;
+                       }
+               }
+               return null;
+       }
  }