diff --git a/apitools/org.eclipse.pde.api.tools.generator/src/org/eclipse/pde/api/tools/generator/EEGenerator.java b/apitools/org.eclipse.pde.api.tools.generator/src/org/eclipse/pde/api/tools/generator/EEGenerator.java index 5b2ef50..d9a0d1c 100644 --- a/apitools/org.eclipse.pde.api.tools.generator/src/org/eclipse/pde/api/tools/generator/EEGenerator.java +++ b/apitools/org.eclipse.pde.api.tools.generator/src/org/eclipse/pde/api/tools/generator/EEGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2012 IBM Corporation and others. + * Copyright (c) 2011, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at @@ -57,18 +57,16 @@ import org.eclipse.jdt.core.util.IInnerClassesAttributeEntry; import org.eclipse.jdt.core.util.IMethodInfo; import org.eclipse.jdt.core.util.ISignatureAttribute; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.core.JavadocConstants; import org.eclipse.pde.api.tools.generator.util.Util; import org.eclipse.pde.api.tools.internal.IApiXmlConstants; import org.eclipse.pde.api.tools.internal.provisional.ProfileModifiers; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Attribute; -import org.objectweb.asm.ClassAdapter; import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodAdapter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.w3c.dom.DOMException; @@ -86,6 +84,7 @@ *
  • J2SE-1.5,
  • *
  • JavaSE-1.6,
  • *
  • JavaSE-1.7,
  • + *
  • JavaSE-1.8,
  • *
  • CDC-1.0_Foundation-1.0,
  • *
  • CDC-1.1_Foundation-1.1,
  • *
  • OSGi_Minimum-1.0
  • , @@ -93,7 +92,7 @@ *
  • OSGi_Minimum-1.2.
  • * * This can be called using: - * -output c:/EE_descriptions -config C:\OSGi_profiles\configuration.properties -EEs JRE-1.1,J2SE-1.2,J2SE-1.3,J2SE-1.4,J2SE-1.5,JavaSE-1.6,JavaSE-1.7,CDC-1.0_Foundation-1.0,CDC-1.1_Foundation-1.1,OSGi_Minimum-1.0,OSGi_Minimum-1.1,OSGi_Minimum-1.2 + * -output c:/EE_descriptions -config C:\OSGi_profiles\configuration.properties -EEs JRE-1.1,J2SE-1.2,J2SE-1.3,J2SE-1.4,J2SE-1.5,JavaSE-1.6,JavaSE-1.7,JavaSE-1.8,CDC-1.0_Foundation-1.0,CDC-1.1_Foundation-1.1,OSGi_Minimum-1.0,OSGi_Minimum-1.1,OSGi_Minimum-1.2 */ public class EEGenerator { static class AbstractNode { @@ -1167,7 +1166,7 @@ /** * Class adapter */ - static class StubClassAdapter extends ClassAdapter { + static class StubClassAdapter extends ClassVisitor { static final int IGNORE_CLASS_FILE = 0x100; int flags; @@ -1180,7 +1179,7 @@ * @param stubtype */ public StubClassAdapter(Type stubtype) { - super(new ClassWriter(0)); + super(Opcodes.ASM5, new ClassWriter(0)); this.type = stubtype; } @@ -1268,7 +1267,7 @@ return null; } final StubMethod method = this.stub.addMethod(methodName, desc); - return new MethodAdapter(super.visitMethod(access, methodName, desc, signature, exceptions)) { + return new MethodVisitor(Opcodes.ASM5, super.visitMethod(access, methodName, desc, signature, exceptions)) { @Override public AnnotationVisitor visitAnnotation(String sig, boolean visible) { if (visible && "Ljava/lang/invoke/MethodHandle$PolymorphicSignature;".equals(sig)) { //$NON-NLS-1$ @@ -1369,7 +1368,7 @@ InputStream inputStream = null; try { inputStream = docZip.getInputStream(entry); - return org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray(inputStream, -1, null); + return Util.getInputStreamAsCharArray(inputStream, -1, null); } catch(IOException e) { e.printStackTrace(); } finally { @@ -1384,19 +1383,19 @@ return null; } static boolean isFinal(int accessFlags) { - return (accessFlags & ClassFileConstants.AccFinal) != 0; + return (accessFlags & Flags.AccFinal) != 0; } static boolean isPrivate(int accessFlags) { - return (accessFlags & ClassFileConstants.AccPrivate) != 0; + return (accessFlags & Flags.AccPrivate) != 0; } static boolean isProtected(int accessFlags) { - return (accessFlags & ClassFileConstants.AccProtected) != 0; + return (accessFlags & Flags.AccProtected) != 0; } static boolean isPublic(int accessFlags) { - return (accessFlags & ClassFileConstants.AccPublic) != 0; + return (accessFlags & Flags.AccPublic) != 0; } static boolean isStatic(int accessFlags) { - return (accessFlags & ClassFileConstants.AccStatic) != 0; + return (accessFlags & Flags.AccStatic) != 0; } private static boolean isVisibleField(int typeAccessFlags, int fieldAccessFlags) { @@ -1663,7 +1662,7 @@ if (this.superinterfacesNames != null && this.superinterfacesNames.length != 0) { type.setAttribute(IApiXmlConstants.ATTR_SUPER_INTERFACES, Util.getInterfaces(this.superinterfacesNames)); } - type.setAttribute(IApiXmlConstants.ATTR_INTERFACE, Boolean.toString((this.modifiers & ClassFileConstants.AccInterface) != 0)); + type.setAttribute(IApiXmlConstants.ATTR_INTERFACE, Boolean.toString((this.modifiers & Flags.AccInterface) != 0)); persistAnnotations(type, OSGiProfileName); if (this.fields != null) { Field[] allFields = new Field[this.fields.size()]; @@ -1733,6 +1732,7 @@ "J2SE-1.5", //$NON-NLS-1$ "JavaSE-1.6", //$NON-NLS-1$ "JavaSE-1.7", //$NON-NLS-1$ + "JavaSE-1.8", //$NON-NLS-1$ "CDC-1.0_Foundation-1.0", //$NON-NLS-1$ "CDC-1.1_Foundation-1.1", //$NON-NLS-1$ "OSGi_Minimum-1.0", //$NON-NLS-1$ @@ -1847,6 +1847,8 @@ } mode = DEFAULT; continue; + default: + break; } } if (this.output == null) { diff --git a/apitools/org.eclipse.pde.api.tools.tests/API Tools Test Suite.launch b/apitools/org.eclipse.pde.api.tools.tests/API Tools Test Suite.launch index d5f098e..2040997 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/API Tools Test Suite.launch +++ b/apitools/org.eclipse.pde.api.tools.tests/API Tools Test Suite.launch @@ -14,7 +14,7 @@ - + diff --git a/apitools/org.eclipse.pde.api.tools.tests/META-INF/MANIFEST.MF b/apitools/org.eclipse.pde.api.tools.tests/META-INF/MANIFEST.MF index 4985616..78fe116 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/META-INF/MANIFEST.MF +++ b/apitools/org.eclipse.pde.api.tools.tests/META-INF/MANIFEST.MF @@ -22,7 +22,7 @@ org.eclipse.jdt.core.tests.builder;bundle-version="[3.8.0,4.0.0)", org.eclipse.jdt.core.tests.compiler;bundle-version="[3.8.0,4.0.0)", org.eclipse.ant.core, - org.objectweb.asm;bundle-version="[3.2.0,4.0.0)", + org.objectweb.asm;bundle-version="5.0.0", org.eclipse.jface;bundle-version="3.8.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.eclipse.pde.api.tools.anttasks.tests, diff --git a/apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF b/apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF index ff54acb..0e7a4e2 100644 --- a/apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF +++ b/apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ org.eclipse.text;bundle-version="[3.4.0,4.0.0)", org.eclipse.core.filebuffers;bundle-version="[3.4.0,4.0.0)", org.eclipse.ant.core;bundle-version="[3.1.300,4.0.0)", - org.objectweb.asm;bundle-version="[3.2.0,4.0.0)", + org.objectweb.asm;bundle-version="5.0.0", org.eclipse.team.core;bundle-version="[3.4.0,4.0.0)", org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)", org.eclipse.equinox.frameworkadmin;bundle-version="[2.0.0,3.0.0)", diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ReferenceExtractor.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ReferenceExtractor.java index f269577..b206096 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ReferenceExtractor.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ReferenceExtractor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 IBM Corporation and others. + * Copyright (c) 2007, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,11 +34,10 @@ import org.eclipse.pde.api.tools.internal.provisional.model.IApiType; import org.eclipse.pde.api.tools.internal.util.Signatures; import org.eclipse.pde.api.tools.internal.util.Util; -import org.objectweb.asm.ClassAdapter; import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.Label; -import org.objectweb.asm.MethodAdapter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; @@ -51,7 +50,7 @@ * * @since 1.0.0 */ -public class ReferenceExtractor extends ClassAdapter { +public class ReferenceExtractor extends ClassVisitor { /** * A visitor for visiting java 5+ signatures @@ -61,7 +60,7 @@ * MethodSignature = (visitFormalTypeParameter visitClassBound? visitInterfaceBound* )* (visitParameterType visitReturnType visitExceptionType* ) * TypeSignature = visitBaseType | visitTypeVariable | visitArrayType | (visitClassType visitTypeArgument* (visitInnerClassType visitTypeArgument* )* visitEnd ) ) */ - class ClassFileSignatureVisitor implements SignatureVisitor { + class ClassFileSignatureVisitor extends SignatureVisitor { protected int kind = -1; protected int originalkind = -1; @@ -72,6 +71,7 @@ protected List references; public ClassFileSignatureVisitor() { + super(Opcodes.ASM5); this.references = new ArrayList(); } @@ -222,7 +222,7 @@ * Visitor used to visit the methods of a type * [ visitCode ( visitFrame | visitXInsn | visitLabel | visitTryCatchBlock | visitLocalVariable | visitLineNumber)* visitMaxs ] visitEnd */ - class ClassFileMethodVisitor extends MethodAdapter { + class ClassFileMethodVisitor extends MethodVisitor { int argumentcount = 0; LinePositionTracker linePositionTracker; /** @@ -241,7 +241,7 @@ * @param mv */ public ClassFileMethodVisitor(MethodVisitor mv, String name, int argumentcount) { - super(mv); + super(Opcodes.ASM5, mv); this.argumentcount = argumentcount; this.linePositionTracker = new LinePositionTracker(); this.lastLineNumber = -1; @@ -909,7 +909,7 @@ * @param referenceKinds kinds of references to extract as defined by {@link ReferenceModifiers} */ public ReferenceExtractor(IApiType type, Set collector, int referenceKinds) { - super(new ClassNode()); + super(Opcodes.ASM5, new ClassNode()); fType = type; this.collector = collector; fReferenceKinds = referenceKinds; @@ -925,7 +925,7 @@ * @param tracker */ protected ReferenceExtractor(IApiType type, Set collector, int referenceKinds, FieldTracker tracker) { - super(new ClassNode()); + super(Opcodes.ASM5, new ClassNode()); fType = type; this.collector = collector; fReferenceKinds = referenceKinds; diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/SignatureDecoder.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/SignatureDecoder.java index 0f861c7..7209c81 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/SignatureDecoder.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/SignatureDecoder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,12 +10,13 @@ *******************************************************************************/ package org.eclipse.pde.api.tools.internal.comparator; +import org.objectweb.asm.Opcodes; import org.objectweb.asm.signature.SignatureVisitor; /** * This class is used to decode a generic signature for class or method */ -final class SignatureDecoder implements SignatureVisitor { +final class SignatureDecoder extends SignatureVisitor { static final int CLASS_BOUND = 1; static final int DEFAULT = 0; static final int INTERFACE_BOUND = 2; @@ -28,6 +29,7 @@ SignatureDescriptor signatureDescriptor; public SignatureDecoder(SignatureDescriptor signatureDescriptor) { + super(Opcodes.ASM5); this.signatureDescriptor = signatureDescriptor; } public SignatureVisitor visitArrayType() { @@ -59,6 +61,8 @@ case SUPER_TYPE_ARGUMENT : case NORMAL_TYPE_ARGUMENT : this.signatureDescriptor.addTypeArgument(classTypeName); + break; + default: break; } this.mode = DEFAULT; @@ -115,6 +119,9 @@ break; case SignatureVisitor.INSTANCEOF : this.mode= NORMAL_TYPE_ARGUMENT; + break; + default: + break; } return this; } diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java index e463b6c..760fd6c 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java @@ -834,7 +834,6 @@ } return new String(Util.getInputStreamAsCharArray(stream, -1, IApiCoreConstants.UTF_8)); } catch(IOException e) { - //TODO abort ApiPlugin.log(e); } finally { closingZipFileAndStream(stream, jarFile); @@ -1178,9 +1177,11 @@ temp = new String[] { ProfileModifiers.J2SE_1_5_NAME }; } else if (ProfileModifiers.isJAVASE_1_6(values)) { temp = new String[] { ProfileModifiers.JAVASE_1_6_NAME }; - } else { - // this is 1.7 + } else if (ProfileModifiers.isJAVASE_1_7(values)) { temp = new String[] { ProfileModifiers.JAVASE_1_7_NAME }; + } else { + // this is 1.8 + temp = new String[] { ProfileModifiers.JAVASE_1_8_NAME }; } } if (ProfileModifiers.isCDC_Foundation(values)) { diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/TypeStructureBuilder.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/TypeStructureBuilder.java index 8275598..f1c7f5e 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/TypeStructureBuilder.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/TypeStructureBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 IBM Corporation and others. + * Copyright (c) 2007, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,8 +14,6 @@ import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; import java.util.HashMap; import java.util.Map; @@ -30,21 +28,18 @@ import org.eclipse.pde.api.tools.internal.provisional.model.IApiType; import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeRoot; import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassAdapter; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.Label; -import org.objectweb.asm.MethodAdapter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.util.TraceAnnotationVisitor; /** * Class adapter used to create an API type structure */ -public class TypeStructureBuilder extends ClassAdapter { +public class TypeStructureBuilder extends ClassVisitor { ApiType fType; IApiComponent fComponent; IApiTypeRoot fFile; @@ -59,13 +54,13 @@ * @param component originating API component or null if unknown */ TypeStructureBuilder(ClassVisitor cv, IApiComponent component, IApiTypeRoot file) { - super(cv); + super(Opcodes.ASM5, cv); fComponent = component; fFile = file; } - /** - * @see org.objectweb.asm.ClassAdapter#visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) + /* (non-Javadoc) + * @see org.objectweb.asm.ClassVisitor#visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) */ public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { StringBuffer simpleSig = new StringBuffer(); @@ -96,8 +91,9 @@ } super.visit(version, laccess, name, signature, superName, interfaces); } - /** - * @see org.objectweb.asm.ClassAdapter#visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int) + + /* (non-Javadoc) + * @see org.objectweb.asm.ClassVisitor#visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int) */ public void visitInnerClass(String name, String outerName, String innerName, int access) { super.visitInnerClass(name, outerName, innerName, access); @@ -127,14 +123,14 @@ } /* (non-Javadoc) - * @see org.objectweb.asm.ClassAdapter#visitOuterClass(java.lang.String, java.lang.String, java.lang.String) + * @see org.objectweb.asm.ClassVisitor#visitOuterClass(java.lang.String, java.lang.String, java.lang.String) */ public void visitOuterClass(String owner, String name, String desc) { fType.setEnclosingMethodInfo(name, desc); } /* (non-Javadoc) - * @see org.objectweb.asm.ClassAdapter#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object) + * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object) */ public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { int laccess = access; @@ -147,7 +143,7 @@ } /* (non-Javadoc) - * @see org.objectweb.asm.ClassAdapter#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) + * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) */ public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { String[] names = null; @@ -163,7 +159,7 @@ } } final ApiMethod method = fType.addMethod(name, desc, signature, laccess, names); - return new MethodAdapter(super.visitMethod(laccess, name, desc, signature, exceptions)) { + return new MethodVisitor(Opcodes.ASM5, super.visitMethod(laccess, name, desc, signature, exceptions)) { public AnnotationVisitor visitAnnotation(String sig, boolean visible) { if (visible && "Ljava/lang/invoke/MethodHandle$PolymorphicSignature;".equals(sig)) { //$NON-NLS-1$ method.isPolymorphic(); @@ -171,18 +167,7 @@ return super.visitAnnotation(sig, visible); } public AnnotationVisitor visitAnnotationDefault() { - return new TraceAnnotationVisitor() { - public void visitEnd() { - super.visitEnd(); - StringWriter stringWriter = new StringWriter(); - PrintWriter writer = new PrintWriter(stringWriter); - print(writer); - writer.flush(); - writer.close(); - String def = String.valueOf(stringWriter.getBuffer()); - method.setDefaultValue(def); - } - }; + return new AnnotationDefaultVisitor(method); } }; } @@ -201,18 +186,28 @@ try { ClassReader classReader = new ClassReader(bytes); classReader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_FRAMES); - } catch (ArrayIndexOutOfBoundsException e) { - if(ApiPlugin.DEBUG_BUILDER) { - IStatus status = new Status(IStatus.ERROR, - ApiPlugin.PLUGIN_ID, - NLS.bind(Messages.TypeStructureBuilder_badClassFileEncountered, file.getTypeName()), - e); - ApiPlugin.log(status); - } - return null; + } + catch (ArrayIndexOutOfBoundsException e) { + return logAndReturn(file, e); + } + catch(IllegalArgumentException iae){ + //thrown from ASM 5.0 for bad bytcodes + return logAndReturn(file, iae); } return visitor.fType; } + + private static IApiType logAndReturn(IApiTypeRoot file, Exception e) { + if(ApiPlugin.DEBUG_BUILDER) { + IStatus status = new Status(IStatus.ERROR, + ApiPlugin.PLUGIN_ID, + NLS.bind(Messages.TypeStructureBuilder_badClassFileEncountered, file.getTypeName()), + e); + ApiPlugin.log(status); + } + return null; + } + /** * Builds a type structure with the given .class file bytes in the specified * API component. @@ -241,14 +236,73 @@ } } } - static class EnclosingMethodSetter extends ClassAdapter { + /** + * Visit the default value for an annotation + */ + static class AnnotationDefaultVisitor extends AnnotationVisitor { + ApiMethod method; + Object value; + StringBuffer buff = new StringBuffer(); + boolean trace = false; + int traceCount = 0; + + public AnnotationDefaultVisitor(ApiMethod method) { + super(Opcodes.ASM5); + this.method = method; + } + public void visit(String name, Object value) { + if(trace) { + appendValue(value); + traceCount++; + return; + } + this.value = value; + } + public AnnotationVisitor visitAnnotation(String name, String desc) { + trace = true; + return this; + } + public void visitEnum(String name, String desc, String value) { + if(trace) { + appendValue(value); + traceCount++; + return; + } + this.value = value; + } + public AnnotationVisitor visitArray(String name) { + trace = true; + return this; + } + public void visitEnd() { + if(trace) { + this.value = buff.toString(); + traceCount--; + trace = traceCount != 0; + } + else { + method.setDefaultValue(this.value == null ? null : this.value.toString()); + } + } + void appendValue(Object val) { + if(val != null) { + if(buff.length() < 1) { + buff.append(val.toString()); + } + else { + buff.append(',').append(val.toString()); + } + } + } + } + static class EnclosingMethodSetter extends ClassVisitor { String name; String signature; boolean found = false; String typeName; public EnclosingMethodSetter(ClassVisitor cv, String typeName) { - super(cv); + super(Opcodes.ASM5, cv); this.typeName = typeName.replace('.', '/'); } public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { @@ -274,11 +328,11 @@ return null; } } - static class TypeNameFinder extends MethodAdapter { + static class TypeNameFinder extends MethodVisitor { protected EnclosingMethodSetter setter; public TypeNameFinder(MethodVisitor mv, EnclosingMethodSetter enclosingMethodSetter) { - super(mv); + super(Opcodes.ASM5, mv); this.setter = enclosingMethodSetter; } public void visitTypeInsn(int opcode, String type) { diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/ProfileModifiers.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/ProfileModifiers.java index db06752..02e1103 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/ProfileModifiers.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/ProfileModifiers.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 IBM Corporation and others. + * Copyright (c) 2007, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,8 @@ *
  • J2SE-1.4
  • *
  • J2SE-1.5
  • *
  • JavaSE-1.6
  • + *
  • JavaSE-1.7
  • + *
  • JavaSE-1.8
  • *
  • JRE-1.1
  • *
  • OSGi_Minimum-1.0
  • *
  • OSGi_Minimum-1.1
  • @@ -42,6 +44,7 @@ public static final String J2SE_1_5_NAME = "J2SE-1.5"; //$NON-NLS-1$ public static final String JAVASE_1_6_NAME = "JavaSE-1.6"; //$NON-NLS-1$ public static final String JAVASE_1_7_NAME = "JavaSE-1.7"; //$NON-NLS-1$ + public static final String JAVASE_1_8_NAME = "JavaSE-1.8"; //$NON-NLS-1$ public static final String JRE_1_1_NAME = "JRE-1.1"; //$NON-NLS-1$ public static final String OSGI_MINIMUM_1_0_NAME = "OSGi/Minimum-1.0"; //$NON-NLS-1$ public static final String OSGI_MINIMUM_1_1_NAME = "OSGi/Minimum-1.1"; //$NON-NLS-1$ @@ -88,7 +91,7 @@ public static final int JAVASE_1_6 = 0x0080; /** - * Constant indicating the corresponding element has been defined in the JavaSE-1.6 profile + * Constant indicating the corresponding element has been defined in the JavaSE-1.7 profile */ public static final int JAVASE_1_7 = 0x0100; @@ -108,6 +111,11 @@ public static final int OSGI_MINIMUM_1_2 = 0x0800; /** + * Constant indicating the corresponding element has been defined in the JavaSE-1.8 profile + */ + public static final int JAVASE_1_8 = 0x1000; + + /** * Constant indicating all the OSGi profiles are defined */ public static final int OSGI_MINIMUM_MASK = OSGI_MINIMUM_1_0 | OSGI_MINIMUM_1_1 | OSGI_MINIMUM_1_2; @@ -120,7 +128,7 @@ /** * Constant indicating all the jres profiles are defined */ - public static final int JRES_MAX = JRE_1_1 | J2SE_1_2 | J2SE_1_3 | J2SE_1_4 | J2SE_1_5 | JAVASE_1_6 | JAVASE_1_7; + public static final int JRES_MAX = JRE_1_1 | J2SE_1_2 | J2SE_1_3 | J2SE_1_4 | J2SE_1_5 | JAVASE_1_6 | JAVASE_1_7 | JAVASE_1_8; /** * Constructor @@ -207,6 +215,16 @@ public static boolean isJAVASE_1_7(int modifiers) { return (modifiers & JAVASE_1_7) > 0; } + + /** + * Returns if the JAVASE_1_8 modifier has been set in the given modifiers. + * + * @param modifiers the given modifiers + * @return true if the JAVASE_1_8 modifier has been set in the specified modifiers, false otherwise + */ + public static boolean isJAVASE_1_8(int modifiers) { + return (modifiers & JAVASE_1_8) > 0; + } /** * Returns if the JRE_1_1 modifier has been set in the given modifiers. @@ -276,6 +294,9 @@ if (JAVASE_1_7_NAME.equals(profileName)) { return JAVASE_1_7; } + if (JAVASE_1_8_NAME.equals(profileName)) { + return JAVASE_1_8; + } if (JRE_1_1_NAME.equals(profileName)) { return JRE_1_1; } @@ -309,6 +330,8 @@ return JAVASE_1_6_NAME; case JAVASE_1_7 : return JAVASE_1_7_NAME; + case JAVASE_1_8 : + return JAVASE_1_8_NAME; case JRE_1_1 : return JRE_1_1_NAME; case OSGI_MINIMUM_1_0 : @@ -354,10 +377,10 @@ J2SE_1_5, JAVASE_1_6, JAVASE_1_7, + JAVASE_1_8, OSGI_MINIMUM_1_0, OSGI_MINIMUM_1_1, OSGI_MINIMUM_1_2, }; } } -