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
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user