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

feature: add CtModifiable#isTransient and related methods #3670

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
30 changes: 30 additions & 0 deletions src/main/java/spoon/reflect/declaration/CtModifiable.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,34 @@ public interface CtModifiable extends CtElement {
*/
@DerivedProperty
boolean isAbstract();

/**
* Returns true if it contains a transient modifier (see {@link #hasModifier(ModifierKind)})
*/
@DerivedProperty
boolean isTransient();

/**
* Returns true if it contains a volatile modifier (see {@link #hasModifier(ModifierKind)})
*/
@DerivedProperty
boolean isVolatile();

/**
* Returns true if it contains a synchronized modifier (see {@link #hasModifier(ModifierKind)})
*/
@DerivedProperty
boolean isSynchronized();

/**
* Returns true if it contains a native modifier (see {@link #hasModifier(ModifierKind)})
*/
@DerivedProperty
boolean isNative();

/**
* Returns true if it contains a strictfp modifier (see {@link #hasModifier(ModifierKind)})
*/
@DerivedProperty
boolean isStrictfp();
}
20 changes: 20 additions & 0 deletions src/main/java/spoon/support/reflect/CtModifierHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,26 @@ public boolean isFinal() {
return getModifiers().contains(ModifierKind.FINAL);
}

public boolean isTransient() {
return getModifiers().contains(ModifierKind.TRANSIENT);
}

public boolean isVolatile() {
return getModifiers().contains(ModifierKind.VOLATILE);
}

public boolean isSynchronized() {
return getModifiers().contains(ModifierKind.SYNCHRONIZED);
}

public boolean isNative() {
return getModifiers().contains(ModifierKind.NATIVE);
}

public boolean isStrictfp() {
return getModifiers().contains(ModifierKind.STRICTFP);
}

@Override
public int hashCode() {
return getModifiers().hashCode();
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/spoon/support/reflect/code/CtCatchVariableImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,29 @@ public boolean isStatic() {
public boolean isAbstract() {
return this.modifierHandler.isAbstract();
}

@Override
public boolean isTransient() {
return this.modifierHandler.isTransient();
}

@Override
public boolean isVolatile() {
return this.modifierHandler.isVolatile();
}

@Override
public boolean isSynchronized() {
return this.modifierHandler.isSynchronized();
}

@Override
public boolean isNative() {
return this.modifierHandler.isNative();
}

@Override
public boolean isStrictfp() {
return this.modifierHandler.isStrictfp();
}
}
25 changes: 25 additions & 0 deletions src/main/java/spoon/support/reflect/code/CtLocalVariableImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,29 @@ public boolean isStatic() {
public boolean isAbstract() {
return this.modifierHandler.isAbstract();
}

@Override
public boolean isTransient() {
return this.modifierHandler.isTransient();
}

@Override
public boolean isVolatile() {
return this.modifierHandler.isVolatile();
}

@Override
public boolean isSynchronized() {
return this.modifierHandler.isSynchronized();
}

@Override
public boolean isNative() {
return this.modifierHandler.isNative();
}

@Override
public boolean isStrictfp() {
return this.modifierHandler.isStrictfp();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,29 @@ public boolean isStatic() {
public boolean isAbstract() {
return this.modifierHandler.isAbstract();
}

@Override
public boolean isTransient() {
return this.modifierHandler.isTransient();
}

@Override
public boolean isVolatile() {
return this.modifierHandler.isVolatile();
}

@Override
public boolean isSynchronized() {
return this.modifierHandler.isSynchronized();
}

@Override
public boolean isNative() {
return this.modifierHandler.isNative();
}

@Override
public boolean isStrictfp() {
return this.modifierHandler.isStrictfp();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,29 @@ public boolean isStatic() {
public boolean isAbstract() {
return this.modifierHandler.isAbstract();
}

@Override
public boolean isTransient() {
return this.modifierHandler.isTransient();
}

@Override
public boolean isVolatile() {
return this.modifierHandler.isVolatile();
}

@Override
public boolean isSynchronized() {
return this.modifierHandler.isSynchronized();
}

@Override
public boolean isNative() {
return this.modifierHandler.isNative();
}

@Override
public boolean isStrictfp() {
return this.modifierHandler.isStrictfp();
}
}
25 changes: 25 additions & 0 deletions src/main/java/spoon/support/reflect/declaration/CtFieldImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,31 @@ public boolean isAbstract() {
return this.modifierHandler.isAbstract();
}

@Override
public boolean isTransient() {
return this.modifierHandler.isTransient();
}

@Override
public boolean isVolatile() {
return this.modifierHandler.isVolatile();
}

@Override
public boolean isSynchronized() {
return this.modifierHandler.isSynchronized();
}

@Override
public boolean isNative() {
return this.modifierHandler.isNative();
}

@Override
public boolean isStrictfp() {
return this.modifierHandler.isStrictfp();
}

@Override
public boolean isPartOfJointDeclaration() {
if (this.getPosition() instanceof NoSourcePosition) {
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,31 @@ public boolean isAbstract() {
return this.modifierHandler.isAbstract();
}

@Override
public boolean isTransient() {
return this.modifierHandler.isTransient();
}

@Override
public boolean isVolatile() {
return this.modifierHandler.isVolatile();
}

@Override
public boolean isSynchronized() {
return this.modifierHandler.isSynchronized();
}

@Override
public boolean isNative() {
return this.modifierHandler.isNative();
}

@Override
public boolean isStrictfp() {
return this.modifierHandler.isStrictfp();
}

@Override
public CtMethod<?> copyMethod() {
return Refactoring.copyMethod(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,29 @@ public boolean isStatic() {
public boolean isAbstract() {
return this.modifierHandler.isAbstract();
}

@Override
public boolean isTransient() {
return this.modifierHandler.isTransient();
}

@Override
public boolean isVolatile() {
return this.modifierHandler.isVolatile();
}

@Override
public boolean isSynchronized() {
return this.modifierHandler.isSynchronized();
}

@Override
public boolean isNative() {
return this.modifierHandler.isNative();
}

@Override
public boolean isStrictfp() {
return this.modifierHandler.isStrictfp();
}
}
25 changes: 25 additions & 0 deletions src/main/java/spoon/support/reflect/declaration/CtTypeImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,31 @@ public boolean isAbstract() {
return this.modifierHandler.isAbstract();
}

@Override
public boolean isTransient() {
return this.modifierHandler.isTransient();
}

@Override
public boolean isSynchronized() {
return this.modifierHandler.isSynchronized();
}

@Override
public boolean isNative() {
return this.modifierHandler.isNative();
}

@Override
public boolean isStrictfp() {
return this.modifierHandler.isStrictfp();
}

@Override
public boolean isVolatile() {
return this.modifierHandler.isVolatile();
}

@Override
public CtType<?> copyType() {
return Refactoring.copyType(this);
Expand Down
Loading