summaryrefslogtreecommitdiff
path: root/jar/jar_test.go
diff options
context:
space:
mode:
author Anton Hansson <hansson@google.com> 2023-09-22 07:17:37 +0000
committer Anton Hansson <hansson@google.com> 2023-09-26 09:55:52 +0000
commit2863e4535eb65e15f955dc8ed48fa99b1d2a1db5 (patch)
treea2c82bd86012ee155dae397aabbdf4a4d935d239 /jar/jar_test.go
parent370e34172f28f7bd8bdfa7b3b8a846523f2eba33 (diff)
Make package parsing code consume annotations
The code previously assumed an annotation meant there was no package declaration, but package declarations can be annotated. Update the code to consume any leading annotations. Bug: 151360309 Test: jar_test.go (& manual verification on full bootclasspath srcs) Change-Id: I3de5a2a675363fc3627a278103dd2cabe80a2d80
Diffstat (limited to 'jar/jar_test.go')
-rw-r--r--jar/jar_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/jar/jar_test.go b/jar/jar_test.go
index c92011e12..61da9bb6f 100644
--- a/jar/jar_test.go
+++ b/jar/jar_test.go
@@ -61,6 +61,16 @@ func TestGetJavaPackage(t *testing.T) {
in: "package 0foo.bar;",
wantErr: true,
},
+ {
+ name: "annotations",
+ in: "@NonNullApi\n@X\npackage foo.bar;",
+ want: "foo.bar",
+ },
+ {
+ name: "complex annotation",
+ in: "@Foo(x=y)\n@package foo.bar;",
+ wantErr: true, // Complex annotation not supported yet.
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {