Browse Source

Removed some unneeded static fields

Jared 5 years ago
parent
commit
aaca0261f1
No account linked to committer's email address

+ 4
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/NativeAnnotationDefinition.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.codemodel.annotations;
6
 package org.openzen.zenscript.codemodel.annotations;
7
 
7
 
8
-import java.util.Collections;
9
-import java.util.List;
10
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
11
 import org.openzen.zenscript.codemodel.FunctionHeader;
9
 import org.openzen.zenscript.codemodel.FunctionHeader;
12
 import org.openzen.zenscript.codemodel.FunctionParameter;
10
 import org.openzen.zenscript.codemodel.FunctionParameter;
24
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
22
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
25
 import org.openzen.zenscript.codemodel.type.StringTypeID;
23
 import org.openzen.zenscript.codemodel.type.StringTypeID;
26
 
24
 
25
+import java.util.Collections;
26
+import java.util.List;
27
+
27
 /**
28
 /**
28
  *
29
  *
29
  * @author Hoofdgebruiker
30
  * @author Hoofdgebruiker
31
 public class NativeAnnotationDefinition implements AnnotationDefinition {
32
 public class NativeAnnotationDefinition implements AnnotationDefinition {
32
 	public static final NativeAnnotationDefinition INSTANCE = new NativeAnnotationDefinition();
33
 	public static final NativeAnnotationDefinition INSTANCE = new NativeAnnotationDefinition();
33
 	
34
 	
34
-	private static final List<FunctionHeader> INITIALIZERS = Collections.singletonList(
35
+	private final List<FunctionHeader> INITIALIZERS = Collections.singletonList(
35
 			new FunctionHeader(BasicTypeID.VOID, StringTypeID.UNIQUE));
36
 			new FunctionHeader(BasicTypeID.VOID, StringTypeID.UNIQUE));
36
 	
37
 	
37
 	private NativeAnnotationDefinition() {}
38
 	private NativeAnnotationDefinition() {}

+ 23
- 10
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/definitions/JavaDefinitionVisitor.java View File

1
 package org.openzen.zenscript.javabytecode.compiler.definitions;
1
 package org.openzen.zenscript.javabytecode.compiler.definitions;
2
 
2
 
3
-import org.openzen.zenscript.codemodel.member.MethodMember;
4
-import org.openzen.zenscript.javashared.*;
5
 import org.objectweb.asm.ClassWriter;
3
 import org.objectweb.asm.ClassWriter;
6
 import org.objectweb.asm.Opcodes;
4
 import org.objectweb.asm.Opcodes;
7
-import org.openzen.zenscript.codemodel.definition.*;
5
+import org.openzen.zenscript.codemodel.definition.AliasDefinition;
6
+import org.openzen.zenscript.codemodel.definition.ClassDefinition;
7
+import org.openzen.zenscript.codemodel.definition.DefinitionVisitor;
8
+import org.openzen.zenscript.codemodel.definition.EnumDefinition;
9
+import org.openzen.zenscript.codemodel.definition.ExpansionDefinition;
10
+import org.openzen.zenscript.codemodel.definition.FunctionDefinition;
11
+import org.openzen.zenscript.codemodel.definition.InterfaceDefinition;
12
+import org.openzen.zenscript.codemodel.definition.StructDefinition;
13
+import org.openzen.zenscript.codemodel.definition.VariantDefinition;
8
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
14
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
9
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
15
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
16
+import org.openzen.zenscript.codemodel.member.ImplementationMember;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
17
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
11
 import org.openzen.zenscript.codemodel.type.GenericTypeID;
18
 import org.openzen.zenscript.codemodel.type.GenericTypeID;
19
+import org.openzen.zenscript.codemodel.type.StoredType;
12
 import org.openzen.zenscript.javabytecode.JavaBytecodeContext;
20
 import org.openzen.zenscript.javabytecode.JavaBytecodeContext;
13
-import org.openzen.zenscript.javabytecode.compiler.*;
21
+import org.openzen.zenscript.javabytecode.compiler.CompilerUtils;
22
+import org.openzen.zenscript.javabytecode.compiler.JavaClassWriter;
23
+import org.openzen.zenscript.javabytecode.compiler.JavaStatementVisitor;
24
+import org.openzen.zenscript.javabytecode.compiler.JavaWriter;
25
+import org.openzen.zenscript.javashared.JavaClass;
26
+import org.openzen.zenscript.javashared.JavaMethod;
27
+import org.openzen.zenscript.javashared.JavaModifiers;
28
+import org.openzen.zenscript.javashared.JavaTypeGenericVisitor;
29
+import org.openzen.zenscript.javashared.JavaVariantOption;
14
 
30
 
15
-import java.io.FileNotFoundException;
16
 import java.io.FileOutputStream;
31
 import java.io.FileOutputStream;
17
 import java.io.IOException;
32
 import java.io.IOException;
18
 import java.util.ArrayList;
33
 import java.util.ArrayList;
19
 import java.util.List;
34
 import java.util.List;
20
-import org.openzen.zenscript.codemodel.member.ImplementationMember;
21
-import org.openzen.zenscript.codemodel.type.StoredType;
22
 
35
 
23
 
36
 
24
 public class JavaDefinitionVisitor implements DefinitionVisitor<byte[]> {
37
 public class JavaDefinitionVisitor implements DefinitionVisitor<byte[]> {
25
-	private static final JavaMethod CLASS_FORNAME
38
+	private final JavaMethod CLASS_FORNAME
26
 			= JavaMethod.getNativeStatic(JavaClass.CLASS, "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
39
 			= JavaMethod.getNativeStatic(JavaClass.CLASS, "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
27
-	private static final JavaMethod ENUM_VALUEOF
40
+	private final JavaMethod ENUM_VALUEOF
28
 			= JavaMethod.getNativeStatic(JavaClass.CLASS, "valueOf", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;");
41
 			= JavaMethod.getNativeStatic(JavaClass.CLASS, "valueOf", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;");
29
-	private static final JavaMethod ARRAY_CLONE
42
+	private final JavaMethod ARRAY_CLONE
30
 			= JavaMethod.getNativeVirtual(JavaClass.ARRAYS, "clone", "()Ljava/lang/Object;");
43
 			= JavaMethod.getNativeVirtual(JavaClass.ARRAYS, "clone", "()Ljava/lang/Object;");
31
 
44
 
32
 	private final JavaClassWriter outerWriter;
45
 	private final JavaClassWriter outerWriter;

+ 2
- 2
JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareDefinitionVisitor.java View File

41
  * @author Hoofdgebruiker
41
  * @author Hoofdgebruiker
42
  */
42
  */
43
 public class JavaPrepareDefinitionVisitor implements DefinitionVisitor<JavaClass> {
43
 public class JavaPrepareDefinitionVisitor implements DefinitionVisitor<JavaClass> {
44
-	private static final Map<String, JavaNativeClass> nativeClasses = new HashMap<>();
44
+	private final Map<String, JavaNativeClass> nativeClasses = new HashMap<>();
45
 	
45
 	
46
-	static {
46
+	 {
47
 		{
47
 		{
48
 			JavaNativeClass cls = new JavaNativeClass(new JavaClass("java.lang", "StringBuilder", JavaClass.Kind.CLASS));
48
 			JavaNativeClass cls = new JavaNativeClass(new JavaClass("java.lang", "StringBuilder", JavaClass.Kind.CLASS));
49
 			cls.addConstructor("constructor", "()V");
49
 			cls.addConstructor("constructor", "()V");

Loading…
Cancel
Save