List of usage examples for org.objectweb.asm.tree AnnotationNode AnnotationNode
AnnotationNode(final List<Object> values)
From source file:com.android.build.gradle.internal.incremental.InstantRunVerifierTest.java
License:Apache License
@Test public void testDiffListOnAnnotationNodes() throws Exception { AnnotationNode original = new AnnotationNode("Ltest/SomeAnnotation;"); original.values = Lists.newArrayList("modules", Type.getObjectType("test/DaggerModule")); AnnotationNode updated = new AnnotationNode("Ltest/SomeAnnotation;"); updated.values = Lists.newArrayList("modules", Type.getObjectType("test/DaggerModule")); assertEquals(InstantRunVerifier.Diff.NONE, InstantRunVerifier.diffList(Lists.newArrayList(original), Lists.newArrayList(updated), InstantRunVerifier.ANNOTATION_COMPARATOR)); }
From source file:com.android.build.gradle.internal.incremental.InstantRunVerifierTest.java
License:Apache License
@Test public void testDiffListOnAnnotationNodesEntriesDataSwap() throws Exception { AnnotationNode original = new AnnotationNode("Ltest/SomeAnnotation;"); original.visit("entry1", "data1"); original.visit("entry2", "data2"); AnnotationNode updated = new AnnotationNode("Ltest/SomeAnnotation;"); updated.visit("entry1", "data2"); updated.visit("entry2", "data1"); assertEquals(InstantRunVerifier.Diff.CHANGE, InstantRunVerifier.diffList(Lists.newArrayList(original), Lists.newArrayList(updated), InstantRunVerifier.ANNOTATION_COMPARATOR)); }
From source file:com.android.build.gradle.internal.incremental.InstantRunVerifierTest.java
License:Apache License
@Test public void testDiffListOnAnnotationNodesDiffEntriesOrder() throws Exception { AnnotationNode original = new AnnotationNode("Ltest/SomeAnnotation;"); original.visit("entry1", "data1"); original.visit("entry2", "data2"); AnnotationNode updated = new AnnotationNode("Ltest/SomeAnnotation;"); updated.visit("entry2", "data2"); updated.visit("entry1", "data1"); assertEquals(InstantRunVerifier.Diff.NONE, InstantRunVerifier.diffList(Lists.newArrayList(original), Lists.newArrayList(updated), InstantRunVerifier.ANNOTATION_COMPARATOR)); }
From source file:com.android.build.gradle.internal.incremental.InstantRunVerifierTest.java
License:Apache License
@Test public void testDiffListOnAnnotationNodesWithEnumEntryValue() throws Exception { AnnotationNode original = new AnnotationNode("Ltest/SomeAnnotation;"); original.visitEnum("entry", "Test", "LMyEnum"); AnnotationNode updated = new AnnotationNode("Ltest/SomeAnnotation;"); updated.visitEnum("entry", "Test", "LMyEnum"); assertEquals(InstantRunVerifier.Diff.NONE, InstantRunVerifier.diffList(Lists.newArrayList(original), Lists.newArrayList(updated), InstantRunVerifier.ANNOTATION_COMPARATOR)); }
From source file:com.android.build.gradle.internal.incremental.InstantRunVerifierTest.java
License:Apache License
@Test public void testDiffListOnAnnotationNodesWithAnnotationNodeValue() throws Exception { AnnotationNode original = new AnnotationNode("Ltest/SomeAnnotation;"); AnnotationVisitor newAnnotation = original.visitAnnotation("InnerAnnotation", "LTest;"); newAnnotation.visit("innerEntry", "innerValue"); newAnnotation.visitEnd();/*from w w w .j a v a 2 s . c o m*/ AnnotationNode updated = new AnnotationNode("Ltest/SomeAnnotation;"); newAnnotation = updated.visitAnnotation("InnerAnnotation", "LTest;"); newAnnotation.visit("innerEntry", "innerValue"); newAnnotation.visitEnd(); assertEquals(InstantRunVerifier.Diff.NONE, InstantRunVerifier.diffList(Lists.newArrayList(original), Lists.newArrayList(updated), InstantRunVerifier.ANNOTATION_COMPARATOR)); }
From source file:com.android.build.gradle.internal.incremental.InstantRunVerifierTest.java
License:Apache License
@Test public void testDiffListOnAnnotationNodesWithArrayValues() throws Exception { AnnotationNode original = new AnnotationNode("Ltest/SomeAnnotation;"); original.visit("byteArray", new byte[] { 1, 2, 3 }); original.visit("booleanArray", new boolean[] { false, true, false }); original.visit("shortArray", new short[] { 1, 2, 3 }); original.visit("charArray", new char[] { 'a', 'b', 'c' }); original.visit("intArray", new int[] { 1, 2, 3 }); original.visit("longArray", new long[] { 1, 2, 3 }); original.visit("floatArray", new float[] { 1, 2, 3 }); original.visit("doubleArray", new double[] { 1, 2, 3 }); original.visit("stringArray", new String[] { "1", "2", "3" }); AnnotationNode updated = new AnnotationNode("Ltest/SomeAnnotation;"); updated.visit("byteArray", new byte[] { 1, 2, 3 }); updated.visit("booleanArray", new boolean[] { false, true, false }); updated.visit("shortArray", new short[] { 1, 2, 3 }); updated.visit("charArray", new char[] { 'a', 'b', 'c' }); updated.visit("intArray", new int[] { 1, 2, 3 }); updated.visit("longArray", new long[] { 1, 2, 3 }); updated.visit("floatArray", new float[] { 1, 2, 3 }); updated.visit("doubleArray", new double[] { 1, 2, 3 }); updated.visit("stringArray", new String[] { "1", "2", "3" }); assertEquals(InstantRunVerifier.Diff.NONE, InstantRunVerifier.diffList(Lists.newArrayList(original), Lists.newArrayList(updated), InstantRunVerifier.ANNOTATION_COMPARATOR)); }
From source file:com.android.build.gradle.internal.incremental.InstantRunVerifierTest.java
License:Apache License
@Test public void testDiffListOnAnnotationNodesWithAnnotationArrayValue() throws Exception { AnnotationNode original = new AnnotationNode("Ltest/SomeAnnotation;"); AnnotationVisitor arrayVisitor = original.visitArray("test"); AnnotationVisitor newAnnotation = arrayVisitor.visitAnnotation("InnerAnnotation", "LTest;"); newAnnotation.visit("innerEntry", "innerValue"); newAnnotation.visitEnd();/* w w w . j av a2 s . c om*/ newAnnotation = arrayVisitor.visitAnnotation("InnerAnnotation", "LTest;"); newAnnotation.visit("innerEntry", "innerValue"); newAnnotation.visitEnd(); arrayVisitor.visitEnd(); AnnotationNode updated = new AnnotationNode("Ltest/SomeAnnotation;"); arrayVisitor = updated.visitArray("test"); newAnnotation = arrayVisitor.visitAnnotation("InnerAnnotation", "LTest;"); newAnnotation.visit("innerEntry", "innerValue"); newAnnotation.visitEnd(); newAnnotation = arrayVisitor.visitAnnotation("InnerAnnotation", "LTest;"); newAnnotation.visit("innerEntry", "innerValue"); newAnnotation.visitEnd(); arrayVisitor.visitEnd(); assertEquals(InstantRunVerifier.Diff.NONE, InstantRunVerifier.diffList(Lists.newArrayList(original), Lists.newArrayList(updated), InstantRunVerifier.ANNOTATION_COMPARATOR)); }
From source file:com.android.build.gradle.internal.incremental.InstantRunVerifierTest.java
License:Apache License
@Test public void testDiffListOnAnnotationNodesWithIntArrayValue() throws Exception { AnnotationNode original = new AnnotationNode("Ltest/SomeAnnotation;"); AnnotationVisitor test = original.visitArray("test"); test.visit("stub", 1); test.visit("stub", 2); test.visit("stub", 3); test.visitEnd();// w w w .j av a 2s. c om AnnotationNode updated = new AnnotationNode("Ltest/SomeAnnotation;"); test = updated.visitArray("test"); test.visit("stub", 1); test.visit("stub", 2); test.visit("stub", 3); test.visitEnd(); assertEquals(InstantRunVerifier.Diff.NONE, InstantRunVerifier.diffList(Lists.newArrayList(original), Lists.newArrayList(updated), InstantRunVerifier.ANNOTATION_COMPARATOR)); }
From source file:com.seovic.pof.PortableTypeGenerator.java
License:Apache License
public UserType instrumentClass() { if (isPortableType() && !isEnum() && !isInstrumented()) { LOG.info("Instrumenting portable type " + cn.name); populatePropertyMap();// w w w .ja v a2 s . c om implementDefaultConstructor(); implementReadExternal(); implementWriteExternal(); // mark as instrumented cn.visibleAnnotations.add(new AnnotationNode(Type.getDescriptor(Instrumented.class))); Type serializerClass = getPofSerializer(); SerializerType serializerType = serializerClass.getClassName() .equals(PortableTypeSerializer.class.getName()) ? null : new SerializerType(serializerClass.getClassName(), null); return new UserType(BigInteger.valueOf(getTypeId()), cn.name.replace("/", "."), serializerType); } return null; }
From source file:com.seovic.pof.PortableTypeGenerator.java
License:Apache License
private void addPofIndex(FieldNode fn, int index) { AnnotationNode an = new AnnotationNode(Type.getDescriptor(PofIndex.class)); an.values = Arrays.asList("value", index); fn.visibleAnnotations.add(an);// w w w . ja v a 2 s. c o m }