List of usage examples for org.objectweb.asm Opcodes V1_8
int V1_8
To view the source code for org.objectweb.asm Opcodes V1_8.
Click Source Link
From source file:org.codehaus.groovy.runtime.callsite.CallSiteGenerator.java
License:Apache License
private static void classHeader(ClassWriter cw, String internalName, String superName) { if (VMPluginFactory.getPlugin().getVersion() >= 8) { cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, internalName, null, superName, null); } else {/*w w w . ja v a2 s. com*/ cw.visit(Opcodes.V1_4, Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, internalName, null, superName, null); } }
From source file:org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.java
License:Apache License
protected void storeTargetMethod(final Expression call, final MethodNode directMethodCallCandidate) { call.putNodeMetaData(DIRECT_METHOD_CALL_TARGET, directMethodCallCandidate); if (directMethodCallCandidate != null && directMethodCallCandidate.isStatic() && directMethodCallCandidate.getDeclaringClass().isInterface() && !(directMethodCallCandidate instanceof ExtensionMethodNode)) { typeCheckingContext.getEnclosingClassNode().putNodeMetaData(MINIMUM_BYTECODE_VERSION, Opcodes.V1_8); }/*from w w w .j av a 2 s . co m*/ checkOrMarkPrivateAccess(call, directMethodCallCandidate); checkSuperCallFromClosure(call, directMethodCallCandidate); extension.onMethodSelection(call, directMethodCallCandidate); }
From source file:org.eclipse.pde.api.tools.internal.builder.ReferenceExtractor.java
License:Open Source License
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if (fIsVisitMembers) { IApiMember member = this.getMember(); IApiType owner = null;/*from w w w. ja v a 2 s . c o m*/ if (member instanceof IApiType) { owner = (IApiType) member; } else { try { owner = member.getEnclosingType(); } catch (CoreException e) { // should not happen for field or method ApiPlugin.log(e.getStatus()); } } if (owner == null) { return null; } IApiMethod method = owner.getMethod(name, desc); if (method == null) { ApiPlugin.log(new Status(IStatus.WARNING, ApiPlugin.PLUGIN_ID, NLS.bind(BuilderMessages.ReferenceExtractor_failed_to_lookup_method, new String[] { name, desc, Signatures.getQualifiedTypeSignature(owner) }))); // if we can't find the method there is no point trying to // process it return null; } this.enterMember(method); // record potential method override reference if ((access & (Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC)) > 0) { try { IApiType def = null; if (fVersion >= Opcodes.V1_8) { // See if we are overriding a default interface method def = getDefaultDefined(owner, name, desc, true); } if (def != null) { addReference(Reference.methodReference(method, def.getName(), method.getName(), method.getSignature(), IReference.REF_OVERRIDE, IReference.F_DEFAULT_METHOD)); } else if (!this.fSuperStack.isEmpty()) { String superTypeName = this.fSuperStack.peek(); addReference(Reference.methodReference(method, superTypeName, method.getName(), method.getSignature(), IReference.REF_OVERRIDE)); } } catch (CoreException e) { // Do nothing, skip this reference } } int argumentcount = 0; if ((access & Opcodes.ACC_SYNTHETIC) == 0) { if (signature != null) { this.processSignature(name, signature, IReference.REF_PARAMETERIZED_METHODDECL, METHOD); argumentcount = this.signaturevisitor.argumentcount; } else { Type[] arguments = Type.getArgumentTypes(desc); for (int i = 0; i < arguments.length; i++) { Type type = arguments[i]; this.addTypeReference(type, IReference.REF_PARAMETER); argumentcount += type.getSize(); } this.addTypeReference(Type.getReturnType(desc), IReference.REF_RETURNTYPE); if (exceptions != null) { for (int i = 0; i < exceptions.length; i++) { this.addTypeReference(Type.getObjectType(exceptions[i]), IReference.REF_THROWS); } } } } MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); if (mv != null && ((access & (Opcodes.ACC_NATIVE | Opcodes.ACC_ABSTRACT)) == 0)) { return new ClassFileMethodVisitor(mv, name, argumentcount); } } return null; }
From source file:org.jacoco.core.internal.data.CRC64.java
License:Open Source License
/** * Calculates class identifier for the given class bytes. * * @param bytes/*from w w w .java 2 s .com*/ * class bytes * @return class identifier */ public static long classId(final byte[] bytes) { if (bytes.length > 7 && bytes[6] == 0x00 && bytes[7] == Opcodes.V9) { // To support early versions of Java 9 we did a trick - change of // Java 9 class files version on Java 8. Unfortunately this also // affected class identifiers. long sum = update(0, bytes, 0, 7); sum = update(sum, (byte) Opcodes.V1_8); return update(sum, bytes, 8, bytes.length); } return update(0, bytes, 0, bytes.length); }
From source file:org.jacoco.core.internal.data.CRC64Test.java
License:Open Source License
@Test public void except_java_9_checksums_should_be_different_for_different_bytecode_versions() { assertEquals(0x589E9080A572741EL, CRC64.classId(createClass(Opcodes.V10))); // should remove workaround for Java 9 // during change of exec file version assertEquals(0x1007, ExecutionDataWriter.FORMAT_VERSION); assertEquals(0xB5284860A572741CL, CRC64.classId(createClass(Opcodes.V9))); assertEquals(0xB5284860A572741CL, CRC64.classId(createClass(Opcodes.V1_8))); assertEquals(0x45284D30A572741AL, CRC64.classId(createClass(Opcodes.V1_7))); }
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactory.java
License:Open Source License
/** * Creates a suitable strategy instance for the class described by the given * reader. Created instance must be used only to process a class or * interface for which it has been created and must be used only once. * * @param classId// w ww. j a v a 2 s . co m * class identifier * @param reader * reader to get information about the class * @param accessorGenerator * accessor to the coverage runtime * @return strategy instance */ public static IProbeArrayStrategy createFor(final long classId, final ClassReader reader, final IExecutionDataAccessorGenerator accessorGenerator) { final String className = reader.getClassName(); final int version = InstrSupport.getMajorVersion(reader); if (isInterfaceOrModule(reader)) { final ProbeCounter counter = getProbeCounter(reader); if (counter.getCount() == 0) { return new NoneProbeArrayStrategy(); } if (version >= Opcodes.V11 && counter.hasMethods()) { return new CondyProbeArrayStrategy(className, true, classId, accessorGenerator); } if (version >= Opcodes.V1_8 && counter.hasMethods()) { return new InterfaceFieldProbeArrayStrategy(className, classId, counter.getCount(), accessorGenerator); } else { return new LocalProbeArrayStrategy(className, classId, counter.getCount(), accessorGenerator); } } else { if (version >= Opcodes.V11) { return new CondyProbeArrayStrategy(className, false, classId, accessorGenerator); } return new ClassFieldProbeArrayStrategy(className, classId, InstrSupport.needsFrames(version), accessorGenerator); } }
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java
License:Open Source License
@Test public void testClass8() { final IProbeArrayStrategy strategy = test(Opcodes.V1_8, 0, false, true, true); assertEquals(ClassFieldProbeArrayStrategy.class, strategy.getClass()); assertDataField(InstrSupport.DATAFIELD_ACC); assertInitMethod(true);/*from w w w. j a va 2 s .c o m*/ strategy.storeInstance(cv.visitMethod(0, null, null, null, null), false, 0); }
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java
License:Open Source License
@Test public void testInterface8() { cv.isInterface = true;//from w w w . ja va 2s . c o m final IProbeArrayStrategy strategy = test(Opcodes.V1_8, Opcodes.ACC_INTERFACE, false, true, true); assertEquals(InterfaceFieldProbeArrayStrategy.class, strategy.getClass()); assertDataField(InstrSupport.DATAFIELD_INTF_ACC); assertInitAndClinitMethods(); strategy.storeInstance(cv.visitMethod(0, null, null, null, null), false, 0); }
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java
License:Open Source License
@Test public void testEmptyInterface8() { final IProbeArrayStrategy strategy = test(Opcodes.V1_8, Opcodes.ACC_INTERFACE, false, false, false); assertEquals(NoneProbeArrayStrategy.class, strategy.getClass()); assertNoDataField();//from w ww . ja v a 2s.c om assertNoInitMethod(); }
From source file:org.jacoco.core.internal.instr.ProbeArrayStrategyFactoryTest.java
License:Open Source License
@Test(expected = UnsupportedOperationException.class) public void testEmptyInterface8StoreInstance() { final IProbeArrayStrategy strategy = test(Opcodes.V1_8, Opcodes.ACC_INTERFACE, false, false, false); strategy.storeInstance(null, false, 0); }