From f91242c6959471b6c463538be8876a2cba29f3d3 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Sat, 15 Jun 2013 12:20:45 -0400 Subject: SI-7014 Annot arg may refer to annotated class's member This only reduces the crasher to a warning. --- test/files/pos/t7014/ThreadSafety.java | 9 +++++++++ test/files/pos/t7014/ThreadSafetyLevel.java | 8 ++++++++ test/files/pos/t7014/t7014.scala | 4 ++++ 3 files changed, 21 insertions(+) create mode 100644 test/files/pos/t7014/ThreadSafety.java create mode 100644 test/files/pos/t7014/ThreadSafetyLevel.java create mode 100644 test/files/pos/t7014/t7014.scala (limited to 'test/files/pos') diff --git a/test/files/pos/t7014/ThreadSafety.java b/test/files/pos/t7014/ThreadSafety.java new file mode 100644 index 0000000000..ed508804e3 --- /dev/null +++ b/test/files/pos/t7014/ThreadSafety.java @@ -0,0 +1,9 @@ +package t7014; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) // must be exactly RUNTIME retention (those we parse) +public @interface ThreadSafety { + ThreadSafetyLevel level(); +} \ No newline at end of file diff --git a/test/files/pos/t7014/ThreadSafetyLevel.java b/test/files/pos/t7014/ThreadSafetyLevel.java new file mode 100644 index 0000000000..4df1dc787a --- /dev/null +++ b/test/files/pos/t7014/ThreadSafetyLevel.java @@ -0,0 +1,8 @@ +package t7014; // package needed due to other bug in scalac's java parser + +// since we parse eagerly, we have not yet parsed the classfile when parsing the annotation, +// and on doing so, fail to find a symbol for the COMPLETELY_THREADSAFE reference +// from the annotation's argument to the enum's member +// for now, let's just not crash -- should implement lazy completing at some point +@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) +public enum ThreadSafetyLevel { COMPLETELY_THREADSAFE } diff --git a/test/files/pos/t7014/t7014.scala b/test/files/pos/t7014/t7014.scala new file mode 100644 index 0000000000..faec4c7740 --- /dev/null +++ b/test/files/pos/t7014/t7014.scala @@ -0,0 +1,4 @@ +package t7014 + +import ThreadSafetyLevel.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed + \ No newline at end of file -- cgit v1.2.3