Fixed double client commands
This commit is contained in:
@@ -2,8 +2,8 @@ package mindustry.annotations.impl;
|
|||||||
|
|
||||||
import com.sun.source.tree.*;
|
import com.sun.source.tree.*;
|
||||||
import com.sun.source.util.*;
|
import com.sun.source.util.*;
|
||||||
import com.sun.tools.javac.code.*;
|
|
||||||
import com.sun.tools.javac.code.Scope;
|
import com.sun.tools.javac.code.Scope;
|
||||||
|
import com.sun.tools.javac.code.*;
|
||||||
import com.sun.tools.javac.code.Symbol.*;
|
import com.sun.tools.javac.code.Symbol.*;
|
||||||
import com.sun.tools.javac.code.Type.*;
|
import com.sun.tools.javac.code.Type.*;
|
||||||
import com.sun.tools.javac.tree.*;
|
import com.sun.tools.javac.tree.*;
|
||||||
@@ -33,16 +33,16 @@ public class CallSuperAnnotationProcessor extends AbstractProcessor{
|
|||||||
if(e.getAnnotation(OverrideCallSuper.class) != null) return false;
|
if(e.getAnnotation(OverrideCallSuper.class) != null) return false;
|
||||||
|
|
||||||
CodeAnalyzerTreeScanner codeScanner = new CodeAnalyzerTreeScanner();
|
CodeAnalyzerTreeScanner codeScanner = new CodeAnalyzerTreeScanner();
|
||||||
codeScanner.setMethodName(e.getSimpleName().toString());
|
codeScanner.methodName = e.getSimpleName().toString();
|
||||||
|
|
||||||
TreePath tp = trees.getPath(e.getEnclosingElement());
|
TreePath tp = trees.getPath(e.getEnclosingElement());
|
||||||
codeScanner.scan(tp, trees);
|
codeScanner.scan(tp, trees);
|
||||||
|
|
||||||
if(codeScanner.isCallSuperUsed()){
|
if(codeScanner.callSuperUsed){
|
||||||
List list = codeScanner.getMethod().getBody().getStatements();
|
List list = codeScanner.method.getBody().getStatements();
|
||||||
|
|
||||||
if(!doesCallSuper(list, codeScanner.getMethodName())){
|
if(!doesCallSuper(list, codeScanner.methodName)){
|
||||||
processingEnv.getMessager().printMessage(Kind.ERROR, "Overriding method '" + codeScanner.getMethodName() + "' must explicitly call super method from its parent class.", e);
|
processingEnv.getMessager().printMessage(Kind.ERROR, "Overriding method '" + codeScanner.methodName + "' must explicitly call super method from its parent class.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,28 +67,28 @@ public class CallSuperAnnotationProcessor extends AbstractProcessor{
|
|||||||
return SourceVersion.RELEASE_8;
|
return SourceVersion.RELEASE_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class CodeAnalyzerTreeScanner extends TreePathScanner<Object, Trees> {
|
static class CodeAnalyzerTreeScanner extends TreePathScanner<Object, Trees>{
|
||||||
private String methodName;
|
private String methodName;
|
||||||
private MethodTree method;
|
private MethodTree method;
|
||||||
private boolean callSuperUsed;
|
private boolean callSuperUsed;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object visitClass (ClassTree classTree, Trees trees) {
|
public Object visitClass(ClassTree classTree, Trees trees){
|
||||||
Tree extendTree = classTree.getExtendsClause();
|
Tree extendTree = classTree.getExtendsClause();
|
||||||
|
|
||||||
if (extendTree instanceof JCTypeApply) { //generic classes case
|
if(extendTree instanceof JCTypeApply){ //generic classes case
|
||||||
JCTypeApply generic = (JCTypeApply) extendTree;
|
JCTypeApply generic = (JCTypeApply)extendTree;
|
||||||
extendTree = generic.clazz;
|
extendTree = generic.clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extendTree instanceof JCIdent) {
|
if(extendTree instanceof JCIdent){
|
||||||
JCIdent tree = (JCIdent) extendTree;
|
JCIdent tree = (JCIdent)extendTree;
|
||||||
com.sun.tools.javac.code.Scope members = tree.sym.members();
|
com.sun.tools.javac.code.Scope members = tree.sym.members();
|
||||||
|
|
||||||
if (checkScope(members))
|
if(checkScope(members))
|
||||||
return super.visitClass(classTree, trees);
|
return super.visitClass(classTree, trees);
|
||||||
|
|
||||||
if (checkSuperTypes((ClassType) tree.type))
|
if(checkSuperTypes((ClassType)tree.type))
|
||||||
return super.visitClass(classTree, trees);
|
return super.visitClass(classTree, trees);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -97,19 +97,19 @@ public class CallSuperAnnotationProcessor extends AbstractProcessor{
|
|||||||
return super.visitClass(classTree, trees);
|
return super.visitClass(classTree, trees);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkSuperTypes (ClassType type) {
|
public boolean checkSuperTypes(ClassType type){
|
||||||
if (type.supertype_field != null && type.supertype_field.tsym != null) {
|
if(type.supertype_field != null && type.supertype_field.tsym != null){
|
||||||
if (checkScope(type.supertype_field.tsym.members()))
|
if(checkScope(type.supertype_field.tsym.members()))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return checkSuperTypes((ClassType) type.supertype_field);
|
return checkSuperTypes((ClassType)type.supertype_field);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public boolean checkScope (Scope members) {
|
public boolean checkScope(Scope members){
|
||||||
Iterable<Symbol> it;
|
Iterable<Symbol> it;
|
||||||
try{
|
try{
|
||||||
it = (Iterable<Symbol>)members.getClass().getMethod("getElements").invoke(members);
|
it = (Iterable<Symbol>)members.getClass().getMethod("getElements").invoke(members);
|
||||||
@@ -121,13 +121,13 @@ public class CallSuperAnnotationProcessor extends AbstractProcessor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Symbol s : it) {
|
for(Symbol s : it){
|
||||||
if (s instanceof MethodSymbol) {
|
if(s instanceof MethodSymbol){
|
||||||
MethodSymbol ms = (MethodSymbol) s;
|
MethodSymbol ms = (MethodSymbol)s;
|
||||||
|
|
||||||
if (ms.getSimpleName().toString().equals(methodName)) {
|
if(ms.getSimpleName().toString().equals(methodName)){
|
||||||
Annotation annotation = ms.getAnnotation(CallSuper.class);
|
Annotation annotation = ms.getAnnotation(CallSuper.class);
|
||||||
if (annotation != null) {
|
if(annotation != null){
|
||||||
callSuperUsed = true;
|
callSuperUsed = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -139,27 +139,12 @@ public class CallSuperAnnotationProcessor extends AbstractProcessor{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object visitMethod (MethodTree methodTree, Trees trees) {
|
public Object visitMethod(MethodTree methodTree, Trees trees){
|
||||||
if (methodTree.getName().toString().equals(methodName))
|
if(methodTree.getName().toString().equals(methodName))
|
||||||
method = methodTree;
|
method = methodTree;
|
||||||
|
|
||||||
return super.visitMethod(methodTree, trees);
|
return super.visitMethod(methodTree, trees);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMethodName (String methodName) {
|
|
||||||
this.methodName = methodName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMethodName () {
|
|
||||||
return methodName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MethodTree getMethod () {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCallSuperUsed () {
|
|
||||||
return callSuperUsed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
fastlane/metadata/android/en-US/changelogs/103.1.txt
Normal file
9
fastlane/metadata/android/en-US/changelogs/103.1.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
- Added new icons w/ smooth scaling
|
||||||
|
- Added liquid void (Contributed by @GioIacca9)
|
||||||
|
- Added bridge opacity slider (Contributed by @Quezler)
|
||||||
|
- Added "underflow" gate (opposite of overflow gate)
|
||||||
|
- Added "emojis" for most blocks and items into the font
|
||||||
|
- Added new tech tree layout w/ better mod support
|
||||||
|
- Added game log file, stored in data folder
|
||||||
|
- Added new separator sprite/animation
|
||||||
|
- Added list of affinity tiles to stats of certain blocks
|
||||||
9
fastlane/metadata/android/en-US/changelogs/103.2.txt
Normal file
9
fastlane/metadata/android/en-US/changelogs/103.2.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
- Added new icons w/ smooth scaling
|
||||||
|
- Added liquid void (Contributed by @GioIacca9)
|
||||||
|
- Added bridge opacity slider (Contributed by @Quezler)
|
||||||
|
- Added "underflow" gate (opposite of overflow gate)
|
||||||
|
- Added "emojis" for most blocks and items into the font
|
||||||
|
- Added new tech tree layout w/ better mod support
|
||||||
|
- Added game log file, stored in data folder
|
||||||
|
- Added new separator sprite/animation
|
||||||
|
- Added list of affinity tiles to stats of certain blocks
|
||||||
9
fastlane/metadata/android/en-US/changelogs/29591.txt
Normal file
9
fastlane/metadata/android/en-US/changelogs/29591.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
- Added new icons w/ smooth scaling
|
||||||
|
- Added liquid void (Contributed by @GioIacca9)
|
||||||
|
- Added bridge opacity slider (Contributed by @Quezler)
|
||||||
|
- Added "underflow" gate (opposite of overflow gate)
|
||||||
|
- Added "emojis" for most blocks and items into the font
|
||||||
|
- Added new tech tree layout w/ better mod support
|
||||||
|
- Added game log file, stored in data folder
|
||||||
|
- Added new separator sprite/animation
|
||||||
|
- Added list of affinity tiles to stats of certain blocks
|
||||||
9
fastlane/metadata/android/en-US/changelogs/29594.txt
Normal file
9
fastlane/metadata/android/en-US/changelogs/29594.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
- Added new icons w/ smooth scaling
|
||||||
|
- Added liquid void (Contributed by @GioIacca9)
|
||||||
|
- Added bridge opacity slider (Contributed by @Quezler)
|
||||||
|
- Added "underflow" gate (opposite of overflow gate)
|
||||||
|
- Added "emojis" for most blocks and items into the font
|
||||||
|
- Added new tech tree layout w/ better mod support
|
||||||
|
- Added game log file, stored in data folder
|
||||||
|
- Added new separator sprite/animation
|
||||||
|
- Added list of affinity tiles to stats of certain blocks
|
||||||
@@ -829,7 +829,6 @@ public class ServerControl implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
|
|
||||||
mods.eachClass(p -> p.registerServerCommands(handler));
|
mods.eachClass(p -> p.registerServerCommands(handler));
|
||||||
mods.eachClass(p -> p.registerClientCommands(netServer.clientCommands));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readCommands(){
|
private void readCommands(){
|
||||||
|
|||||||
Reference in New Issue
Block a user