[Nice-commit] Nice/src/nice/tools/code Import.java,1.5,1.6
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-08-11 16:09:43
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24811/F:/nice/src/nice/tools/code Modified Files: Import.java Log Message: Removed the '--strict' compiler option. Index: Import.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Import.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Import.java 25 Feb 2004 14:23:21 -0000 1.5 --- Import.java 11 Aug 2004 16:09:35 -0000 1.6 *************** *** 91,101 **** } - boolean strictImport = - bossa.modules.Package.currentCompilation.strictJavaTypes; - boolean nonNullArgs = strictPackages.contains (m.getDeclaringClass().getPackageName()); ! if (strictImport || nonNullArgs) { for (int i = 0; i < paramTypes.length; i++) --- 91,98 ---- } boolean nonNullArgs = strictPackages.contains (m.getDeclaringClass().getPackageName()); ! if (nonNullArgs) { for (int i = 0; i < paramTypes.length; i++) *************** *** 112,154 **** mlsub.typing.Monotype retType; if (constructor) // the return type is surely not null retType = Types.monotype(declaringClass.thisType(), true, typeParameters, niceTP); ! else if (strictImport) ! { ! Type returnType = m.getFullReturnType(); ! if (m.getStaticFlag()) ! //no exception found yet to this assumption ! retType = Types.monotype(returnType, true, ! typeParameters, niceTP, true); ! else ! { ! Type classType = declaringClass.thisType(); ! ! if ((returnType.getName() != null) && returnType.getName(). ! equals(classType.getName())) ! //if returntype equals declaringclass than it's almost sure ! //that returntype isn't null, this sort of methods are common ! //in immutable classes such as String ! retType = Types.monotype(returnType, true, typeParameters, ! niceTP); ! else if ((returnType instanceof ParameterizedType) && ! (classType instanceof ParameterizedType) && ! (((ParameterizedType)returnType).main.getName() != null) && ! (((ParameterizedType)returnType).main.getName().equals( ! ((ParameterizedType)classType).main.getName()))) ! //same as above for parameterized classes a bit more difficult ! retType = Types.monotype(returnType, true, typeParameters, ! niceTP); ! else if (returnType instanceof ArrayType) ! //an array can be empty so it should never be null ! retType = Types.monotype(returnType, true, typeParameters, ! niceTP, true); ! else ! //the rest where no good guess is possible about nullness ! retType = Types.monotype(returnType, typeParameters, niceTP); ! } ! } else { ! //if not strict then returntype not null. retType = Types.monotype(m.getFullReturnType(), true, typeParameters, niceTP, true); --- 109,118 ---- mlsub.typing.Monotype retType; if (constructor) + { // the return type is surely not null retType = Types.monotype(declaringClass.thisType(), true, typeParameters, niceTP); ! } else { ! // returntype not null. retType = Types.monotype(m.getFullReturnType(), true, typeParameters, niceTP, true); |