Working Java8 build!

- Split the AspectJ testcode out of the general testdata project.
- Adjusted tests to handle that JDT produces different code to AspectJ.
- Modified some tests to work better with javac compiled testdata (which
  is what happens when building on the command line or build machine)
This commit is contained in:
Andy Clement
2014-02-20 09:13:14 -08:00
parent 526a4d0901
commit e400e2da63
20 changed files with 140 additions and 55 deletions

View File

@@ -111,12 +111,15 @@ public class ClassRenamer {
}
return string;
}
@Override
public MethodVisitor visitMethod(int flags, String name, String descriptor, String signature, String[] exceptions) {
if (descriptor.indexOf(oldname) != -1) {
descriptor = descriptor.replace(oldname, newname);
} else {
if (descriptor.indexOf(oldname) != -1) {
descriptor = descriptor.replace(oldname, newname);
}
for (String s : retargets.keySet()) {
if (descriptor.indexOf(s) != -1) {
descriptor = descriptor.replace(s, retargets.get(s));

View File

@@ -129,7 +129,16 @@ public class ExecutorBuilder {
if (name.charAt(1) != 'c') {
// regular constructor
// want to create the ___init___ handler for this constructor
// With the JDT compiler the inner class constructor gets an extra first parameter that is the type of
// containing class. But with javac the inner class constructor gets an extra first parameter that is of
// a special anonymous type (inner class of the containing class)
// For example: class Foo { class Bar {}}
// JDT: ctor in Bar is <init>(Foo) {}
// JAVAC: ctor in Bar is <init>(Foo$1) {}
descriptor = Utils.insertExtraParameter(classname, descriptor);
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC_STATIC, mInitializerName, descriptor, signature, exceptions);
ConstructorCopier cc = new ConstructorCopier(mv, typeDescriptor, suffix, classname);

View File

@@ -625,7 +625,10 @@ public class TypeDiffComputer implements Opcodes {
// td.setTypeVersionChange(oldClassNode.version, newClassNode.version);
// }
if (oldClassNode.access != newClassNode.access) {
td.setTypeAccessChange(oldClassNode.access, newClassNode.access);
// Is it only because of 0x20000 - that appears to represent Deprecated!
if ((oldClassNode.access & 0xffff) != (newClassNode.access&0xffff)) {
td.setTypeAccessChange(oldClassNode.access, newClassNode.access);
}
}
if (!oldClassNode.name.equals(newClassNode.name)) {
td.setTypeNameChange(oldClassNode.name, newClassNode.name);

View File

@@ -87,7 +87,7 @@ public class Java8 {
* @param lookup
* @return
*/
public static Object emulateInvokeDynamic(Class executorClass, Handle handle, Object[] bsmArgs, Object lookup, String indyNameAndDescriptor, Object[] indyParams) {
public static Object emulateInvokeDynamic(Class<?> executorClass, Handle handle, Object[] bsmArgs, Object lookup, String indyNameAndDescriptor, Object[] indyParams) {
try {
CallSite callsite = callLambdaMetaFactory(bsmArgs,lookup,indyNameAndDescriptor,executorClass);
return callsite.dynamicInvoker().invokeWithArguments(indyParams);
@@ -98,7 +98,7 @@ public class Java8 {
// TODO [perf] How about a table of CallSites indexed by invokedynamic number through the class file. Computed on first reference but cleared on reload. Possibly extend this to all invoke types!
// TODO [lambda] Need to handle altMetaFactory which is used when the lambdas are more 'complex' (e.g. Serializable)
public static CallSite callLambdaMetaFactory(Object[] bsmArgs, Object lookup, String indyNameAndDescriptor,Class executorClass) throws Exception {
public static CallSite callLambdaMetaFactory(Object[] bsmArgs, Object lookup, String indyNameAndDescriptor,Class<?> executorClass) throws Exception {
MethodHandles.Lookup caller = (MethodHandles.Lookup)lookup;
ClassLoader callerLoader = caller.lookupClass().getClassLoader();