-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/manifold-systems/manifold/issues/611
- preserve default values in annotation methods for generated stub classes
- Loading branch information
1 parent
03fc9b9
commit 4c07ef2
Showing
5 changed files
with
94 additions
and
0 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
52 changes: 52 additions & 0 deletions
52
manifold-deps-parent/manifold-ext-middle-test/src/main/java/xyz/OtherAnno.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,52 @@ | ||
/* | ||
* Copyright (c) 2019 - Manifold Systems LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package xyz; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
import static xyz.OtherAnno.Local.*; | ||
|
||
@Retention( RetentionPolicy.CLASS ) | ||
public @interface OtherAnno | ||
{ | ||
String value() default "foo"; | ||
boolean booleanValue() default true; | ||
int intValue() default 9; | ||
double doubleValue() default 9.9; | ||
String stringValue() default "hi"; | ||
Class<?> classValue() default Local.class; | ||
Local enumValue() default B; | ||
InnerAnno annoValue() default @InnerAnno(stringValue = "abc"); | ||
boolean[] booleanArrayValue() default {true,false}; | ||
int[] intArrayValue() default {1,2}; | ||
double[] doubleArrayValue() default {1.2,2.1}; | ||
String[] stringArrayValue() default {"a", "b"}; | ||
Class[] classArrayValue() default {String.class, int.class}; | ||
Local[] enumArrayValue() default {A, B}; | ||
InnerAnno[] annoArrayValue() default {@InnerAnno, @InnerAnno(value=7)}; | ||
|
||
|
||
enum Local {A, B, C} | ||
|
||
@Retention( RetentionPolicy.CLASS ) | ||
@interface InnerAnno | ||
{ | ||
int value() default 0; | ||
String stringValue() default "bar"; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
manifold-deps-parent/manifold-ext-test/src/test/java/abc/ClassThatUsesOtherAnno.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,10 @@ | ||
package abc; | ||
|
||
import xyz.OtherAnno; | ||
|
||
public class ClassThatUsesOtherAnno | ||
{ | ||
// tests that default values exist in generated stub for extended annotation OtherAnno, see MyOtherAnnoExt | ||
@OtherAnno | ||
public void myMethod() {} | ||
} |
9 changes: 9 additions & 0 deletions
9
...ent/manifold-ext-test/src/test/java/manifold/extensions/xyz/OtherAnno/MyOtherAnnoExt.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,9 @@ | ||
package manifold.extensions.xyz.OtherAnno; | ||
|
||
import manifold.ext.rt.api.Extension; | ||
|
||
// tests extending annotation classes with annotations | ||
@Extension | ||
@Deprecated | ||
public class MyOtherAnnoExt { | ||
} |