Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format viewpoint test annotations #940

Merged
merged 4 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ allprojects {

googleJavaFormat().aosp()
importOrder('com', 'jdk', 'lib', 'lombok', 'org', 'java', 'javax')
formatAnnotations().addTypeAnnotation("PolyInitialized")
formatAnnotations().addTypeAnnotation("PolyInitialized").addTypeAnnotation("A").addTypeAnnotation("B").addTypeAnnotation("Bottom").addTypeAnnotation("PolyVP").addTypeAnnotation("ReceiverDependentQual").addTypeAnnotation("Top")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you turn this into two arrays: 1) regular type qualifiers that are not in spotless (yet) 2) test type qualifiers that never make sense to add to spotless.
For the second set, can you add a comment/script, that re-creates the array for future additions?
Then, turn the addTypeAnnotation into a functional style that passes each array element.

}

groovyGradle {
Expand Down
3 changes: 1 addition & 2 deletions framework/tests/viewpointtest/PolyConstructor.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ public class PolyConstructor {

static class MyClass {
@SuppressWarnings({"inconsistent.constructor.type", "super.invocation.invalid"})
@PolyVP
MyClass(@PolyVP Object o) {
@PolyVP MyClass(@PolyVP Object o) {
throw new RuntimeException(" * You are filled with DETERMINATION."); // stub
}
}
Expand Down
3 changes: 1 addition & 2 deletions framework/tests/viewpointtest/PolyWithVPA.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

public class PolyWithVPA {
static class PolyClass {
@ReceiverDependentQual
Object foo(@PolyVP Object o) {
@ReceiverDependentQual Object foo(@PolyVP Object o) {
return null;
}
}
Expand Down
6 changes: 2 additions & 4 deletions framework/tests/viewpointtest/TestGetAnnotatedLhs.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
import viewpointtest.quals.ReceiverDependentQual;
import viewpointtest.quals.Top;

@ReceiverDependentQual
class TestGetAnnotatedLhs {
@ReceiverDependentQual class TestGetAnnotatedLhs {
@ReceiverDependentQual Object f;

@SuppressWarnings({
"inconsistent.constructor.type",
"super.invocation.invalid",
"cast.unsafe.constructor.invocation"
})
@ReceiverDependentQual
TestGetAnnotatedLhs() {
@ReceiverDependentQual TestGetAnnotatedLhs() {
this.f = new @ReceiverDependentQual Object();
}

Expand Down
3 changes: 1 addition & 2 deletions framework/tests/viewpointtest/VPAExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
public class VPAExamples {

static class RDContainer {
@ReceiverDependentQual
Object get() {
@ReceiverDependentQual Object get() {
return null;
}

Expand Down
6 changes: 2 additions & 4 deletions framework/tests/viewpointtest/VarargsConstructor.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ public class VarargsConstructor {
VarargsConstructor(String str, Object... args) {}

@SuppressWarnings({"inconsistent.constructor.type", "super.invocation.invalid"})
@ReceiverDependentQual
VarargsConstructor(@ReceiverDependentQual Object... args) {}
@ReceiverDependentQual VarargsConstructor(@ReceiverDependentQual Object... args) {}

void foo() {
VarargsConstructor a = new VarargsConstructor("testStr", new Object());
Expand All @@ -26,8 +25,7 @@ void invokeConstructor(@A Object aObj, @B Object bObj, @Top Object topObj) {

class Inner {
@SuppressWarnings({"inconsistent.constructor.type", "super.invocation.invalid"})
@ReceiverDependentQual
Inner(@ReceiverDependentQual Object... args) {}
@ReceiverDependentQual Inner(@ReceiverDependentQual Object... args) {}

void foo() {
Inner a = new Inner();
Expand Down