-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added previously failing test case demonstrating instrumentation fa…
…ilure when processing annotations containing enum-type values. * Fixed instrumentation failure when processing annotations containing enum-type values by adding a class visitor to PhosphorPatcher to unwrap TaggedReferenceArrays returned by certain methods in ASM classes instrumentation boundary issues.
- Loading branch information
1 parent
159f5fe
commit 4cf8d4a
Showing
4 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
integration-tests/src/test/java/edu/columbia/cs/psl/test/phosphor/AnnotationInstCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package edu.columbia.cs.psl.test.phosphor; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import java.lang.reflect.Method; | ||
|
||
public class AnnotationInstCase { | ||
@Test | ||
public void testEnum() throws ReflectiveOperationException { | ||
Method method = Example.class.getDeclaredMethod("x"); | ||
ExampleAnnotation annotation = method.getAnnotation(ExampleAnnotation.class); | ||
Assert.assertNotNull(annotation); | ||
Assert.assertEquals(ExampleAnnotation.Color.BLUE, annotation.color()); | ||
} | ||
|
||
public static class Example { | ||
@ExampleAnnotation(color = ExampleAnnotation.Color.BLUE) | ||
void x() {} | ||
} | ||
|
||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ExampleAnnotation { | ||
Color color(); | ||
|
||
enum Color { | ||
RED, | ||
BLUE, | ||
GREEN; | ||
} | ||
} | ||
} |