-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TYPE_USE
annotations were being ignored (#115)
Java's DAG for annotations processors doesn't contain `TYPE_USE` annotations on the Element for some reason. However, they are on the type. So, use the type instead. Note due to limitations of JavaPoet this doesn't fix `TYPE_USE` annotations on parameterized types or array components. If we want to address those we will need changes in JavaPoet which has been dormant for a very long time. Fixes #113 Relates to #111
- Loading branch information
Showing
4 changed files
with
75 additions
and
2 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
22 changes: 22 additions & 0 deletions
22
record-builder-test/src/main/java/io/soabase/recordbuilder/test/typeuse/MyFullRecord.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,22 @@ | ||
/** | ||
* Copyright 2019 Jordan Zimmerman | ||
* | ||
* 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 io.soabase.recordbuilder.test.typeuse; | ||
|
||
import io.soabase.recordbuilder.core.RecordBuilderFull; | ||
|
||
@RecordBuilderFull | ||
public record MyFullRecord(@TypeUseNonNull String nonNullS) { | ||
} |
22 changes: 22 additions & 0 deletions
22
record-builder-test/src/main/java/io/soabase/recordbuilder/test/typeuse/MyRecord.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,22 @@ | ||
/** | ||
* Copyright 2019 Jordan Zimmerman | ||
* | ||
* 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 io.soabase.recordbuilder.test.typeuse; | ||
|
||
import io.soabase.recordbuilder.core.RecordBuilder; | ||
|
||
@RecordBuilder | ||
public record MyRecord(@TypeUseNonNull String nonNullS) { | ||
} |
29 changes: 29 additions & 0 deletions
29
record-builder-test/src/main/java/io/soabase/recordbuilder/test/typeuse/TypeUseNonNull.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,29 @@ | ||
/** | ||
* Copyright 2019 Jordan Zimmerman | ||
* | ||
* 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 io.soabase.recordbuilder.test.typeuse; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.*; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@Documented | ||
@Retention(value = RUNTIME) | ||
@Target(value = {TYPE_USE, RECORD_COMPONENT, TYPE_PARAMETER}) | ||
public @interface TypeUseNonNull { | ||
} |