Skip to content

Commit

Permalink
feature: add CtModifiable#isTransient and related methods (#3670)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artamm authored Nov 5, 2020
1 parent 06ad7f0 commit dae5bd2
Show file tree
Hide file tree
Showing 12 changed files with 308 additions and 19 deletions.
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

0 comments on commit dae5bd2

Please sign in to comment.