|  | @@ -62,7 +62,6 @@ import org.openzen.zenscript.javashared.JavaMethod;
 | 
		
	
		
			
			| 62 | 62 |  import stdlib.Strings;
 | 
		
	
		
			
			| 63 | 63 |  
 | 
		
	
		
			
			| 64 | 64 |  /**
 | 
		
	
		
			
			| 65 |  | - *
 | 
		
	
		
			
			| 66 | 65 |   * @author Stan Hebben
 | 
		
	
		
			
			| 67 | 66 |   */
 | 
		
	
		
			
			| 68 | 67 |  public class JavaNativeModule {
 | 
		
	
	
		
			
			|  | @@ -84,8 +83,7 @@ public class JavaNativeModule {
 | 
		
	
		
			
			| 84 | 83 |  			String name,
 | 
		
	
		
			
			| 85 | 84 |  			String basePackage,
 | 
		
	
		
			
			| 86 | 85 |  			GlobalTypeRegistry registry,
 | 
		
	
		
			
			| 87 |  | -			JavaNativeModule[] dependencies)
 | 
		
	
		
			
			| 88 |  | -	{
 | 
		
	
		
			
			|  | 86 | +			JavaNativeModule[] dependencies) {
 | 
		
	
		
			
			| 89 | 87 |  		this.pkg = pkg;
 | 
		
	
		
			
			| 90 | 88 |  		this.basePackage = basePackage;
 | 
		
	
		
			
			| 91 | 89 |  		module = new Module(name);
 | 
		
	
	
		
			
			|  | @@ -214,7 +212,8 @@ public class JavaNativeModule {
 | 
		
	
		
			
			| 214 | 212 |  	}
 | 
		
	
		
			
			| 215 | 213 |  	
 | 
		
	
		
			
			| 216 | 214 |  	private ZSPackage getPackage(String className) {
 | 
		
	
		
			
			| 217 |  | -		if (!className.contains("."))
 | 
		
	
		
			
			|  | 215 | +		//TODO make a lang package?
 | 
		
	
		
			
			|  | 216 | +		if (!className.contains(".") || className.startsWith("java.lang"))
 | 
		
	
		
			
			| 218 | 217 |  			return pkg;
 | 
		
	
		
			
			| 219 | 218 |  		
 | 
		
	
		
			
			| 220 | 219 |  		if (className.startsWith("."))
 | 
		
	
	
		
			
			|  | @@ -296,10 +295,8 @@ public class JavaNativeModule {
 | 
		
	
		
			
			| 296 | 295 |  				continue;
 | 
		
	
		
			
			| 297 | 296 |  			if (!isPublic(field.getModifiers()))
 | 
		
	
		
			
			| 298 | 297 |  				continue;
 | 
		
	
		
			
			| 299 |  | -
 | 
		
	
		
			
			| 300 |  | -			String fieldName = field.getName();
 | 
		
	
		
			
			| 301 |  | -			if (annotation != null && !annotation.value().isEmpty())
 | 
		
	
		
			
			| 302 |  | -				fieldName = annotation.value();
 | 
		
	
		
			
			|  | 298 | +			
 | 
		
	
		
			
			|  | 299 | +			final String fieldName = annotation.value().isEmpty() ? field.getName() : annotation.value();
 | 
		
	
		
			
			| 303 | 300 |  			
 | 
		
	
		
			
			| 304 | 301 |  			StoredType fieldType = loadStoredType(field.getAnnotatedType());
 | 
		
	
		
			
			| 305 | 302 |  			FieldMember member = new FieldMember(CodePosition.NATIVE, definition, Modifiers.PUBLIC, fieldName, thisType, fieldType, registry, 0, 0, null);
 | 
		
	
	
		
			
			|  | @@ -309,7 +306,7 @@ public class JavaNativeModule {
 | 
		
	
		
			
			| 309 | 306 |  		
 | 
		
	
		
			
			| 310 | 307 |  		boolean hasConstructor = false;
 | 
		
	
		
			
			| 311 | 308 |  		for (java.lang.reflect.Constructor constructor : cls.getConstructors()) {
 | 
		
	
		
			
			| 312 |  | -			ZenCodeType.Constructor constructorAnnotation = (ZenCodeType.Constructor)constructor.getAnnotation(ZenCodeType.Constructor.class);
 | 
		
	
		
			
			|  | 309 | +			ZenCodeType.Constructor constructorAnnotation = (ZenCodeType.Constructor) constructor.getAnnotation(ZenCodeType.Constructor.class);
 | 
		
	
		
			
			| 313 | 310 |  			if (constructorAnnotation != null) {
 | 
		
	
		
			
			| 314 | 311 |  				ConstructorMember member = asConstructor(definition, constructor);
 | 
		
	
		
			
			| 315 | 312 |  				definition.addMember(member);
 | 
		
	
	
		
			
			|  | @@ -487,8 +484,7 @@ public class JavaNativeModule {
 | 
		
	
		
			
			| 487 | 484 |  			AnnotatedType javaReturnType,
 | 
		
	
		
			
			| 488 | 485 |  			AnnotatedType[] parameterTypes,
 | 
		
	
		
			
			| 489 | 486 |  			TypeVariable<Method>[] javaTypeParameters,
 | 
		
	
		
			
			| 490 |  | -			AnnotatedType[] exceptionTypes)
 | 
		
	
		
			
			| 491 |  | -	{
 | 
		
	
		
			
			|  | 487 | +			AnnotatedType[] exceptionTypes) {
 | 
		
	
		
			
			| 492 | 488 |  		StoredType returnType = javaReturnType == null ? BasicTypeID.VOID.stored : loadStoredType(javaReturnType);
 | 
		
	
		
			
			| 493 | 489 |  		
 | 
		
	
		
			
			| 494 | 490 |  		FunctionParameter[] parameters = new FunctionParameter[parameterTypes.length];
 | 
		
	
	
		
			
			|  | @@ -532,7 +528,7 @@ public class JavaNativeModule {
 | 
		
	
		
			
			| 532 | 528 |  	
 | 
		
	
		
			
			| 533 | 529 |  	private TypeID loadType(Type type, boolean nullable, boolean unsigned) {
 | 
		
	
		
			
			| 534 | 530 |  		if (type instanceof Class) {
 | 
		
	
		
			
			| 535 |  | -			Class<?> classType = (Class<?>)type;
 | 
		
	
		
			
			|  | 531 | +			Class<?> classType = (Class<?>) type;
 | 
		
	
		
			
			| 536 | 532 |  			if (unsigned) {
 | 
		
	
		
			
			| 537 | 533 |  				if (unsignedByClass.containsKey(classType))
 | 
		
	
		
			
			| 538 | 534 |  					return unsignedByClass.get(classType);
 | 
		
	
	
		
			
			|  | @@ -548,8 +544,8 @@ public class JavaNativeModule {
 | 
		
	
		
			
			| 548 | 544 |  			HighLevelDefinition definition = addClass(classType);
 | 
		
	
		
			
			| 549 | 545 |  			return registry.getForDefinition(definition);
 | 
		
	
		
			
			| 550 | 546 |  		} else if (type instanceof ParameterizedType) {
 | 
		
	
		
			
			| 551 |  | -			ParameterizedType parameterizedType = (ParameterizedType)type;
 | 
		
	
		
			
			| 552 |  | -			Class<?> rawType = (Class)parameterizedType.getRawType();
 | 
		
	
		
			
			|  | 547 | +			ParameterizedType parameterizedType = (ParameterizedType) type;
 | 
		
	
		
			
			|  | 548 | +			Class<?> rawType = (Class) parameterizedType.getRawType();
 | 
		
	
		
			
			| 553 | 549 |  			
 | 
		
	
		
			
			| 554 | 550 |  			HighLevelDefinition definition = addClass(rawType);
 | 
		
	
		
			
			| 555 | 551 |  			Type[] parameters = parameterizedType.getActualTypeArguments();
 |