nice-commit Mailing List for The Nice Programming Language (Page 47)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Daniel B. <bo...@us...> - 2004-06-16 20:59:45
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9887/src/bossa/syntax Modified Files: PolySymbol.java Log Message: Allow more syntactic polytypes to be garbage-collected. Index: PolySymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/PolySymbol.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PolySymbol.java 25 Feb 2004 11:23:28 -0000 1.18 --- PolySymbol.java 16 Jun 2004 20:59:34 -0000 1.19 *************** *** 60,63 **** --- 60,64 ---- type = syntacticType.resolveToLowlevel(); syntacticType = null; + children = null; } |
From: Daniel B. <bo...@us...> - 2004-06-16 14:56:24
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12590/src/bossa/syntax Modified Files: NiceMethod.java FormalParameters.java Constraint.java AtomicConstraint.java Log Message: Simplification and optimization of the scope building phase. Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** FormalParameters.java 5 Feb 2004 23:55:16 -0000 1.37 --- FormalParameters.java 16 Jun 2004 14:56:14 -0000 1.38 *************** *** 32,38 **** An anonymous formal parameter. */ ! public static class Parameter extends Node { ! public Parameter(Monotype type) { super(Node.down); this.type = type; } Monotype type; --- 32,38 ---- An anonymous formal parameter. */ ! public static class Parameter { ! public Parameter(Monotype type) { this.type = type; } Monotype type; *************** *** 54,58 **** boolean isOverriden() { return false; } ! void resolve() { if (symbol != null) --- 54,58 ---- boolean isOverriden() { return false; } ! void resolve(VarScope scope, TypeScope typeScope) { if (symbol != null) *************** *** 226,234 **** } ! void resolve() { defaultValue = dispatch.analyse(defaultValue, scope, typeScope); defaultValue = defaultValue.noOverloading(); ! super.resolve(); } --- 226,234 ---- } ! void resolve(VarScope scope, TypeScope typeScope) { defaultValue = dispatch.analyse(defaultValue, scope, typeScope); defaultValue = defaultValue.noOverloading(); ! super.resolve(scope, typeScope); } *************** *** 237,241 **** defaultValue = dispatch.analyse(defaultValue, info); defaultValue = defaultValue.noOverloading(); ! super.resolve(); } --- 237,241 ---- defaultValue = dispatch.analyse(defaultValue, info); defaultValue = defaultValue.noOverloading(); ! super.resolve(null, null); } *************** *** 267,271 **** public FormalParameters(java.util.List parameters) { ! super(Node.down); if (parameters == null) --- 267,271 ---- public FormalParameters(java.util.List parameters) { ! super(Node.none); if (parameters == null) *************** *** 275,287 **** (Parameter[]) parameters.toArray(new Parameter[parameters.size()]); this.size = this.parameters.length; - - for (int i = 0; i < size; i++) - if (this.parameters[i] != null) - addChild(this.parameters[i]); } FormalParameters(Parameter[] parameters) { ! super(Node.down); if (parameters == null) --- 275,283 ---- (Parameter[]) parameters.toArray(new Parameter[parameters.size()]); this.size = this.parameters.length; } FormalParameters(Parameter[] parameters) { ! super(Node.none); if (parameters == null) *************** *** 290,297 **** this.parameters = parameters; this.size = parameters.length; - - for (int i = 0; i < size; i++) - if (parameters[i] != null) - addChild(parameters[i]); } --- 286,289 ---- *************** *** 302,308 **** parameters[0] = new NamedParameter(type, thisName); - // We need to add it as the first child, because the order - // is used when refering to previous parameters inside default values. - addFirstChild(parameters[0]); } --- 294,297 ---- *************** *** 379,385 **** } ! void doResolve() { ! super.doResolve(); for (int i = 0; i<size; i++) --- 368,375 ---- } ! void resolve() { ! for (int i = 0; i<size; i++) ! parameters[i].resolve(scope, typeScope); for (int i = 0; i<size; i++) Index: AtomicConstraint.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AtomicConstraint.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AtomicConstraint.java 15 Nov 2003 12:26:32 -0000 1.12 --- AtomicConstraint.java 16 Jun 2004 14:56:14 -0000 1.13 *************** *** 24,34 **** @author Daniel Bonniot (d.b...@ma...) */ ! public abstract class AtomicConstraint extends Node { - AtomicConstraint() - { - super(Node.down); - } - /**************************************************************** * Scoping --- 24,29 ---- @author Daniel Bonniot (d.b...@ma...) */ ! public abstract class AtomicConstraint { /**************************************************************** * Scoping Index: Constraint.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constraint.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Constraint.java 24 Feb 2004 15:50:19 -0000 1.39 --- Constraint.java 16 Jun 2004 14:56:14 -0000 1.40 *************** *** 69,80 **** { if(binders==null) ! binders = noBinders; else addTypeSymbols(binders); this.binders = binders; - this.atomics = addChildren(atomics); - } ! private static final List noBinders = new ArrayList(0); /** --- 69,82 ---- { if(binders==null) ! binders = Collections.EMPTY_LIST; else addTypeSymbols(binders); this.binders = binders; ! if (atomics == null) ! this.atomics = Collections.EMPTY_LIST; ! else ! this.atomics = atomics; ! } /** *************** *** 214,218 **** { // avoid the modification of the shared empty list ! if (binders == noBinders) binders = new ArrayList(4); --- 216,220 ---- { // avoid the modification of the shared empty list ! if (binders == Collections.EMPTY_LIST) binders = new ArrayList(4); *************** *** 227,231 **** { // avoid the modification of the shared empty list ! if (binders == noBinders) binders = new ArrayList(4); --- 229,233 ---- { // avoid the modification of the shared empty list ! if (binders == Collections.EMPTY_LIST) binders = new ArrayList(4); Index: NiceMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceMethod.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** NiceMethod.java 26 Mar 2004 10:48:41 -0000 1.38 --- NiceMethod.java 16 Jun 2004 14:56:14 -0000 1.39 *************** *** 161,165 **** homonyms = Node.getGlobalScope().lookup(getName()); ! homonyms.remove(getSymbol()); } --- 161,168 ---- homonyms = Node.getGlobalScope().lookup(getName()); ! if (homonyms.size() == 1) ! homonyms = null; ! else ! homonyms.remove(getSymbol()); } *************** *** 201,207 **** public boolean specializesMethods() { - //if (homonyms != null) - //throw new Error(this.toString()); - return specializedMethods != null; } --- 204,207 ---- *************** *** 209,217 **** void findSpecializedMethods() { ! if (homonyms.isEmpty()) ! { ! homonyms = null; ! return; ! } Domain ourDomain = Types.domain(getType()); --- 209,214 ---- void findSpecializedMethods() { ! if (homonyms == null) ! return; Domain ourDomain = Types.domain(getType()); |
From: Daniel B. <bo...@us...> - 2004-06-16 10:01:35
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32734/src/bossa/syntax Modified Files: Pattern.java Monotype.java ClassDefinition.java Log Message: Handle type variables that are used simultaneously with and without nullness markers (implements RFE #738496). Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** Pattern.java 9 Jun 2004 17:02:09 -0000 1.83 --- Pattern.java 16 Jun 2004 10:00:37 -0000 1.84 *************** *** 19,22 **** --- 19,23 ---- import mlsub.typing.Monotype; import mlsub.typing.MonotypeConstructor; + import mlsub.typing.Polytype; import mlsub.typing.Typing; import mlsub.typing.TypingEx; *************** *** 160,165 **** return; ! constraint = def.getResolvedConstraint(); ! patternType = new MonotypeConstructor(tc, def.getTypeParameters()); } --- 161,170 ---- return; ! Polytype classType = def.getConstrainedType(); ! if (classType != null) ! { ! constraint = classType.getConstraint(); ! patternType = classType.getMonotype(); ! } } Index: ClassDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ClassDefinition.java,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** ClassDefinition.java 11 Jun 2004 15:53:35 -0000 1.105 --- ClassDefinition.java 16 Jun 2004 10:00:38 -0000 1.106 *************** *** 442,445 **** --- 442,462 ---- } + /** + Return the type representing a constrained instance of this class, + or null if this class has no constraint on its type parameters. + */ + mlsub.typing.Polytype getConstrainedType() + { + mlsub.typing.Constraint cst = getResolvedConstraint(); + + if (cst == null) + return null; + + mlsub.typing.Polytype res = new mlsub.typing.Polytype + (cst, lowlevelMonotype()); + + return res.cloneType(); + } + public abstract boolean isConcrete(); Index: Monotype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Monotype.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Monotype.java 25 Feb 2004 11:23:29 -0000 1.34 --- Monotype.java 16 Jun 2004 10:00:37 -0000 1.35 *************** *** 109,114 **** { case none: return raw; ! case maybe: return maybe(raw); ! case sure: return sure(raw); case absent: if (raw instanceof MonotypeVar) --- 109,114 ---- { case none: return raw; ! case maybe: return sourceMaybe(raw); ! case sure: return sourceSure(raw); case absent: if (raw instanceof MonotypeVar) *************** *** 281,284 **** --- 281,294 ---- ****************************************************************/ + /** + Return a maybe type based on the raw type of the argument + if the argument is a full type. + */ + static mlsub.typing.Monotype sourceMaybe(mlsub.typing.Monotype type) + { + mlsub.typing.Monotype raw = nice.tools.typing.Types.rawType(type); + return maybe(raw); + } + public static mlsub.typing.Monotype maybe(mlsub.typing.Monotype type) { *************** *** 287,290 **** --- 297,310 ---- } + /** + Return a sure type based on the raw type of the argument + if the argument is a full type. + */ + static mlsub.typing.Monotype sourceSure(mlsub.typing.Monotype type) + { + mlsub.typing.Monotype raw = nice.tools.typing.Types.rawType(type); + return sure(raw); + } + public static mlsub.typing.Monotype sure(mlsub.typing.Monotype type) { |
From: Daniel B. <bo...@us...> - 2004-06-16 10:01:24
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32734/testsuite/compiler/classes Modified Files: typeParameters.testsuite Log Message: Handle type variables that are used simultaneously with and without nullness markers (implements RFE #738496). Index: typeParameters.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/typeParameters.testsuite,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** typeParameters.testsuite 4 Mar 2004 15:48:20 -0000 1.16 --- typeParameters.testsuite 16 Jun 2004 10:00:33 -0000 1.17 *************** *** 301,302 **** --- 301,359 ---- <String S> class B<S> extends A<S> {} + + /// PASS + A<String> a; + a = new A(x: null); + a = new A(x: ""); + a.x = null; + a.x = ""; + ?String s = a.x; + + /// Toplevel + class A<T> + { + ?T x; + } + + /// FAIL + A<String> a = new A(x: null); + String s = a.x; + + /// Toplevel + class A<T> + { + ?T x; + } + + /// PASS + A<?String> a; + a = new A(x: ""); + a.x = ""; + String s = a.x; + + /// Toplevel + class A<T> + { + !T x; + } + + /// FAIL + A<String> a = new A(x: null); + + /// Toplevel + class A<T> + { + !T x; + } + + /// PASS + A<int> a1 = new A(a: 2); + ?int i = a1.get(2); + /// Toplevel + class A<T> { + T a; + + ?T get(int i); + get(1) = a; + get(i) = null; + } |
From: Daniel B. <bo...@us...> - 2004-06-16 10:01:16
|
Update of /cvsroot/nice/Nice/src/mlsub/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32734/src/mlsub/typing Modified Files: Polytype.java NullnessKind.java MonotypeVar.java Log Message: Handle type variables that are used simultaneously with and without nullness markers (implements RFE #738496). Index: MonotypeVar.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/MonotypeVar.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MonotypeVar.java 17 Mar 2004 16:55:34 -0000 1.16 --- MonotypeVar.java 16 Jun 2004 10:00:36 -0000 1.17 *************** *** 91,95 **** { res[i] = new MonotypeVar(existential); ! res[i].persistentKind = NullnessKind.instance; } return res; --- 91,95 ---- { res[i] = new MonotypeVar(existential); ! res[i].setPersistentKind(NullnessKind.instance); } return res; *************** *** 157,161 **** --- 157,169 ---- public void setPersistentKind(Kind k) { + if (persistentKind == k) + return; + persistentKind = k; + if (k == NullnessKind.instance) + { + kind = k; + equivalent = NullnessKind.instance.persistentFreshMonotype(); + } } *************** *** 165,176 **** { if (persistentKind == null) - setKind(null); - else { ! // Forget about the old equivalent. equivalent = null; kind = null; setKind(persistentKind); } } --- 173,200 ---- { if (persistentKind == null) { ! setKind(null); ! } ! else if (existential) ! { equivalent = null; kind = null; setKind(persistentKind); } + else if (equivalent != null) + { + if (persistentKind == NullnessKind.instance) + { + MonotypeConstructor mc = (MonotypeConstructor) equivalent(); + + TypeConstructor tc = mc.getTC(); + // Reassign a new id + NullnessKind.introduce(tc); + + MonotypeVar raw = (MonotypeVar) mc.getTP()[0]; + raw.reset(); + mlsub.typing.lowlevel.Engine.register(raw); + } + } } Index: NullnessKind.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/NullnessKind.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NullnessKind.java 17 Mar 2004 16:55:34 -0000 1.3 --- NullnessKind.java 16 Jun 2004 10:00:36 -0000 1.4 *************** *** 43,53 **** { TypeConstructor tc = new TypeConstructor(instance); ! Typing.introduce(tc); ! try { ! Typing.leq(tc, maybe); ! Typing.leq(sure, tc); ! } catch(TypingEx ex) { ! bossa.util.Internal.error("Nullness creation error"); ! } Monotype raw = new MonotypeVar(existential); --- 43,47 ---- { TypeConstructor tc = new TypeConstructor(instance); ! introduce(tc); Monotype raw = new MonotypeVar(existential); *************** *** 57,60 **** --- 51,73 ---- } + public Monotype persistentFreshMonotype() + { + TypeConstructor tc = new TypeConstructor(instance); + Monotype raw = new MonotypeVar(); + + return new MonotypeConstructor(tc, new Monotype[]{ raw }); + } + + static void introduce(TypeConstructor tc) + { + tc.getKind().register(tc); + try { + Typing.leq(tc, maybe); + Typing.leq(sure, tc); + } catch(TypingEx ex) { + bossa.util.Internal.error("Nullness creation error"); + } + } + public void register(Element e) { Index: Polytype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Polytype.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Polytype.java 26 Feb 2004 22:17:39 -0000 1.22 --- Polytype.java 16 Jun 2004 10:00:35 -0000 1.23 *************** *** 58,61 **** --- 58,70 ---- newBinders[i] = binders[i].cloneTypeSymbol(); map.put(binders[i], newBinders[i]); + // Clone the persistent equivalents of marked type variables. + if (binders[i] instanceof MonotypeVar && + ((MonotypeVar) binders[i]).persistentKind != null) + { + MonotypeConstructor mc = (MonotypeConstructor) ((MonotypeVar) binders[i]).equivalent(); + MonotypeConstructor nmc = (MonotypeConstructor) ((MonotypeVar) newBinders[i]).equivalent(); + map.put(mc.getTC(), nmc.getTC()); + map.put(mc.getTP()[0], nmc.getTP()[0]); + } } |
From: Daniel B. <bo...@us...> - 2004-06-16 10:01:15
|
Update of /cvsroot/nice/Nice/src/nice/tools/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32734/src/nice/tools/typing Modified Files: Types.java Log Message: Handle type variables that are used simultaneously with and without nullness markers (implements RFE #738496). Index: Types.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/typing/Types.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Types.java 17 Mar 2004 00:36:46 -0000 1.6 --- Types.java 16 Jun 2004 10:00:34 -0000 1.7 *************** *** 99,110 **** { m = m.equivalent(); ! if (!(m instanceof MonotypeConstructor)) ! { ! // It is probably a bug if this happens ! //Internal.warning("Not kinded monotype: " + m); ! return m; ! } ! else ! return ((MonotypeConstructor) m).getTP()[0]; } --- 99,106 ---- { m = m.equivalent(); ! if (! (m.getKind() == NullnessKind.instance)) ! return m; ! ! return ((MonotypeConstructor) m).getTP()[0]; } |
From: Daniel B. <bo...@us...> - 2004-06-16 10:01:06
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32734 Modified Files: NEWS Log Message: Handle type variables that are used simultaneously with and without nullness markers (implements RFE #738496). Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** NEWS 11 Jun 2004 15:53:36 -0000 1.32 --- NEWS 16 Jun 2004 10:00:51 -0000 1.33 *************** *** 7,10 **** --- 7,17 ---- an interface defined in the current package, with: class some.pkg.ClassName implements MyInterface; + * Type parameters can always be qualified with nullness markers '?' and '!'. + For instance, a class declaration can be + class OptionalRef<T> + { + // The value might be null + ?T value; + } * Allow calls to Java methods defined in a Java class that implements several Java interfaces declaring that same method, like |
From: Daniel B. <bo...@us...> - 2004-06-11 15:59:08
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2062/src/bossa/modules Modified Files: Package.java Log Message: Removed obsolte method, and cleanup. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** Package.java 20 Mar 2004 15:49:24 -0000 1.115 --- Package.java 11 Jun 2004 15:58:58 -0000 1.116 *************** *** 330,334 **** if (!isRoot) return; ! // If at least one package is recompiled, the root will also be recompiled if (compiling()) --- 330,334 ---- if (!isRoot) return; ! // If at least one package is recompiled, the root will also be recompiled if (compiling()) *************** *** 336,342 **** compilation.progress(this, "linking"); bossa.link.Dispatch.test(this); ! finishCompilation(); ! compilation.exitIfErrors(); } --- 336,342 ---- compilation.progress(this, "linking"); bossa.link.Dispatch.test(this); ! finishCompilation(); ! compilation.exitIfErrors(); } *************** *** 428,432 **** } f.println(); ! for(int i = 0; i < opens.length; i++) { --- 428,432 ---- } f.println(); ! for(int i = 0; i < opens.length; i++) { *************** *** 664,677 **** private ClassExp implementationClass, dispatchClass; - private static ModuleExp createModule(String name) - { - ModuleExp res = new ModuleExp(); - res.setName(name); - res.body = QuoteExp.voidExp; - res.setFlag(ModuleExp.STATIC_SPECIFIED); - res.setSuperType(gnu.bytecode.Type.pointer_type); - return res; - } - private ClassExp createClassExp(String name) { --- 664,667 ---- *************** *** 724,728 **** { if (compiling()) ! compilation.progress(this, "generating code"); ast.compile(compiling()); --- 714,718 ---- { if (compiling()) ! compilation.progress(this, "generating code"); ast.compile(compiling()); *************** *** 736,740 **** String className = this.name + "." + name; ! ClassType res; try{ res = ClassType.make(className); --- 726,730 ---- String className = this.name + "." + name; ! ClassType res; try{ res = ClassType.make(className); *************** *** 755,759 **** String attribute, String value) { ! if (clas == null) return null; --- 745,749 ---- String attribute, String value) { ! if (clas == null) return null; *************** *** 766,770 **** // but names appended with "$$..." may not be matched because // that are escape characters ! || m.getName().startsWith(name) && m.getName().charAt(name.length()) == '$' && m.getName().charAt(name.length()+1) != '$') --- 756,760 ---- // but names appended with "$$..." may not be matched because // that are escape characters ! || m.getName().startsWith(name) && m.getName().charAt(name.length()) == '$' && m.getName().charAt(name.length()+1) != '$') *************** *** 794,798 **** as the precise types are found during typechecking. */ ! Method meth = lookupClassMethod(source.getDispatch(), name, "id", def.getFullName()); if (meth != null) // Reuse existing dispatch method header --- 784,788 ---- as the precise types are found during typechecking. */ ! Method meth = lookupClassMethod(source.getDispatch(), name, "id", def.getFullName()); if (meth != null) // Reuse existing dispatch method header *************** *** 800,804 **** // The dispatch code will have to be regenerated anyway meth.eraseCode(); ! argTypes = meth.arg_types; retType = meth.return_type; --- 790,794 ---- // The dispatch code will have to be regenerated anyway meth.eraseCode(); ! argTypes = meth.arg_types; retType = meth.return_type; |
From: Daniel B. <bo...@us...> - 2004-06-11 15:53:46
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28516 Modified Files: NEWS Log Message: Is is now possible to make a class of an imported package implement an interface defined in the current package (fixes #904327). Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** NEWS 10 Jun 2004 13:40:28 -0000 1.31 --- NEWS 11 Jun 2004 15:53:36 -0000 1.32 *************** *** 4,7 **** --- 4,10 ---- not make any difference for Nice programs, but simplifies integration with Java tools and usage of Nice code from Java sources. + * Is is now possible to make a class of an imported package implement + an interface defined in the current package, with: + class some.pkg.ClassName implements MyInterface; * Allow calls to Java methods defined in a Java class that implements several Java interfaces declaring that same method, like |
From: Daniel B. <bo...@us...> - 2004-06-11 15:53:44
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28516/src/bossa/syntax Modified Files: NiceClass.java ClassDefinition.java AbstractInterfaceImplementation.java Log Message: Is is now possible to make a class of an imported package implement an interface defined in the current package (fixes #904327). Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** NiceClass.java 20 Mar 2004 15:49:24 -0000 1.81 --- NiceClass.java 11 Jun 2004 15:53:35 -0000 1.82 *************** *** 894,897 **** --- 894,902 ---- for (int i = 0; i < constructorMethod.length; i++) constructorMethod[i].getCode(); + + // Take into account external interface implementations, which + // can add new interfaces to implement in the bytecode. + classe.supers = computeSupers(); + classe.recomputeInterfaces(); } Index: ClassDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ClassDefinition.java,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** ClassDefinition.java 16 Apr 2004 13:16:59 -0000 1.104 --- ClassDefinition.java 11 Jun 2004 15:53:35 -0000 1.105 *************** *** 72,91 **** TypeConstructor getSuperClass() { return null; } - mlsub.typing.Interface[] getInterfaces() { return extendedInterfaces; } - void resolveClass() { ! extendedInterfaces = this.resolveInterfaces(extensions); extensions = null; - // Resolve the super-interfaces first. - if (extendedInterfaces != null) - for (int i = 0; i < extendedInterfaces.length; i++) - { - ClassDefinition d = ClassDefinition.get(extendedInterfaces[i].associatedTC()); - if (d != null) - d.resolve(); - } - createAssociatedInterface(); --- 72,80 ---- TypeConstructor getSuperClass() { return null; } void resolveClass() { ! this.resolveInterfaces(extensions); extensions = null; createAssociatedInterface(); *************** *** 96,124 **** { try{ - if (extendedInterfaces != null) - try{ - Typing.assertImp(tc, extendedInterfaces, true); - } - catch(KindingEx e){ - User.error(name, - "Interface " + name + " cannot extend " + e.t2 + - ": they do not have the same number or kind of type parameters"); - } - - if (javaInterfaces != null) - for (int i = 0; i < javaInterfaces.length; i++) - try { - Typing.initialLeq(tc, javaInterfaces[i]); - } - catch(KindingEx e){ - User.error(name, - "Interface " + name + " cannot extend " + e.t2 + - ": they do not have the same number or kind of type parameters"); - } - Typing.assertImp(tc, associatedInterface, true); } catch(TypingEx e){ ! User.error(name, "Error in interface " + name + " : " + e.getMessage()); } --- 85,92 ---- { try{ Typing.assertImp(tc, associatedInterface, true); } catch(TypingEx e){ ! User.error(name, "Error in interface " + name, e.getMessage()); } *************** *** 132,176 **** s.print(getSimpleName()); s.print(this.printTypeParameters()); ! s.print(printInterfaces(" extends ", extendedInterfaces)); implementation.printInterface(s); } ! /**************************************************************** ! * Associated interface ! ****************************************************************/ ! private mlsub.typing.Interface associatedInterface; - /** - * Returns the abstract interface associated to this class, or null. - * - * An associated abstract interface in created - * for each "interface" class. - */ - public mlsub.typing.Interface getAssociatedInterface() - { return associatedInterface; } - private void createAssociatedInterface() { // the associated interface extends the associated interfaces // of the classes we extend ! if (extendedInterfaces != null) ! for(int i = 0; i < extendedInterfaces.length; i++) ! { ! mlsub.typing.Interface ai = extendedInterfaces[i]; ! ! try{ ! Typing.assertLeq(associatedInterface, ai); ! } ! catch(KindingEx e){ ! User.error(this, "Cannot extend interface " + ai + ! " which has a different variance"); ! } ! } } ! protected List /* of TypeConstructor */ extensions; - mlsub.typing.Interface[] extendedInterfaces; } --- 100,142 ---- s.print(getSimpleName()); s.print(this.printTypeParameters()); ! s.print(printInterfaces(" extends ", interfaces)); implementation.printInterface(s); } ! /**************************************************************** ! * Associated interface ! ****************************************************************/ ! private mlsub.typing.Interface associatedInterface; ! ! /** ! * Returns the abstract interface associated to this class, or null. ! * ! * An associated abstract interface in created ! * for each "interface" class. ! */ ! public mlsub.typing.Interface getAssociatedInterface() ! { return associatedInterface; } private void createAssociatedInterface() { // the associated interface extends the associated interfaces // of the classes we extend ! for (Iterator i = interfaces.iterator(); i.hasNext();) ! { ! mlsub.typing.Interface ai = (mlsub.typing.Interface) i.next(); ! ! try{ ! Typing.assertLeq(associatedInterface, ai); ! } ! catch(KindingEx e){ ! User.error(this, "Cannot extend interface " + ai + ! " which has a different variance"); ! } ! } } ! protected List /* of TypeConstructor */ extensions; } *************** *** 252,265 **** } - mlsub.typing.Interface[] getInterfaces() { return impl; } - public ClassDefinition.Interface[] getImplementedInterfaces() { ! if (impl == null) return null; List res = new LinkedList(); ! for (int i = 0; i < impl.length; i++) ! { ! Object itf = ClassDefinition.get(impl[i].associatedTC()); if (itf != null) res.add(itf); --- 218,231 ---- } public ClassDefinition.Interface[] getImplementedInterfaces() { ! if (interfaces.size() == 0) return null; List res = new LinkedList(); ! for (Iterator i = interfaces.iterator(); i.hasNext();) ! { ! mlsub.typing.Interface ai = (mlsub.typing.Interface) i.next(); ! ! ClassDefinition itf = ClassDefinition.get(ai.associatedTC()); if (itf != null) res.add(itf); *************** *** 312,327 **** } - if (javaInterfaces != null) - for (int i = 0; i < javaInterfaces.length; i++) - if (tc.arity() == 0 || - ! JavaClasses.excludedInterface(javaInterfaces[i])) - try { - Typing.initialLeq(tc, javaInterfaces[i]); - } - catch(KindingEx e){ - User.error(name, - "Class " + name + " cannot implement " + e.t2 + - ": they do not have the same number or kind of type parameters"); - } } catch(TypingEx e){ --- 278,281 ---- *************** *** 342,346 **** if (superClass != null) s.print(" extends " + superClass); ! s.print(printInterfaces(" implements ", impl)); s.print(Util.map(" finally implements ",", ","",abs)); implementation.printInterface(s); --- 296,300 ---- if (superClass != null) s.print(" extends " + superClass); ! s.print(printInterfaces(" implements ", interfaces)); s.print(Util.map(" finally implements ",", ","",abs)); implementation.printInterface(s); *************** *** 354,357 **** --- 308,315 ---- } + /**************************************************************** + * Generic definition, common to classes and interfaces + ****************************************************************/ + /** * Creates a class definition. *************** *** 375,379 **** /* of Interface */ implementations, /* of Interface */ abstractions; ! mlsub.typing.Interface[] impl, abs; void createTC() --- 333,340 ---- /* of Interface */ implementations, /* of Interface */ abstractions; ! ! mlsub.typing.Interface[] abs; ! ! List interfaces = new ArrayList(5); void createTC() *************** *** 528,532 **** void resolveClass() { ! impl = this.resolveInterfaces(implementations); abs = TypeIdent.resolveToItf(typeScope, abstractions); --- 489,493 ---- void resolveClass() { ! this.resolveInterfaces(implementations); abs = TypeIdent.resolveToItf(typeScope, abstractions); *************** *** 534,544 **** // Resolve the super-interfaces first. ! if (impl != null) ! for (int i = 0; i < impl.length; i++) ! { ! ClassDefinition d = ClassDefinition.get(impl[i].associatedTC()); ! if (d != null) ! d.resolve(); ! } createContext(); --- 495,505 ---- // Resolve the super-interfaces first. ! for (Iterator i = interfaces.iterator(); i.hasNext();) ! { ! mlsub.typing.Interface itf = (mlsub.typing.Interface) i.next(); ! ClassDefinition d = ClassDefinition.get(itf.associatedTC()); ! if (d != null) ! d.resolve(); ! } createContext(); *************** *** 549,559 **** TypeConstructor[] javaInterfaces; ! mlsub.typing.Interface[] resolveInterfaces(List names) { if (names == null) ! return null; - mlsub.typing.Interface[] res = new mlsub.typing.Interface[names.size()]; - int n = 0; ArrayList javaInterfaces = null; --- 510,518 ---- TypeConstructor[] javaInterfaces; ! void resolveInterfaces(List names) { if (names == null) ! return; ArrayList javaInterfaces = null; *************** *** 564,568 **** if (s instanceof mlsub.typing.Interface) ! res[n++] = (mlsub.typing.Interface) s; else { --- 523,527 ---- if (s instanceof mlsub.typing.Interface) ! interfaces.add(s); else { *************** *** 578,591 **** } ! if (n < res.length) // The array is too long ! { ! mlsub.typing.Interface[] tmp = new mlsub.typing.Interface[n]; ! System.arraycopy(res, 0, tmp, 0, n); ! res = tmp; ! this.javaInterfaces = (TypeConstructor[]) ! javaInterfaces.toArray(new TypeConstructor[javaInterfaces.size()]); ! } ! ! return res; } --- 537,543 ---- } ! if (javaInterfaces != null) ! this.javaInterfaces = (TypeConstructor[]) ! javaInterfaces.toArray(new TypeConstructor[javaInterfaces.size()]); } *************** *** 631,637 **** { try { ! if (impl != null) try{ ! Typing.assertImp(tc, impl, true); } catch(KindingEx e){ --- 583,590 ---- { try { ! for (Iterator i = interfaces.iterator(); i.hasNext();) try{ ! mlsub.typing.Interface itf = (mlsub.typing.Interface) i.next(); ! Typing.assertImp(tc, itf, true); } catch(KindingEx e){ *************** *** 646,649 **** --- 599,615 ---- Typing.assertAbs(tc, abs); } + + if (javaInterfaces != null) + for (int i = 0; i < javaInterfaces.length; i++) + if (tc.arity() == 0 || + ! JavaClasses.excludedInterface(javaInterfaces[i])) + try { + Typing.initialLeq(tc, javaInterfaces[i]); + } + catch(KindingEx e){ + User.error(name, + "Class " + name + " cannot implement " + e.t2 + + ": they do not have the same number or kind of type parameters"); + } } catch(TypingEx e){ *************** *** 661,666 **** abstract TypeConstructor getSuperClass(); ! abstract mlsub.typing.Interface[] getInterfaces(); ! private Type javaType; --- 627,641 ---- abstract TypeConstructor getSuperClass(); ! mlsub.typing.Interface[] getInterfaces() ! { ! return (mlsub.typing.Interface[]) ! interfaces.toArray(new mlsub.typing.Interface[interfaces.size()]); ! } ! ! void addInterfaceImplementation(mlsub.typing.Interface itf) ! { ! interfaces.add(itf); ! } ! private Type javaType; *************** *** 685,692 **** } ! String printInterfaces(String keyword, mlsub.typing.Interface[] interfaces) { StringBuffer res = new StringBuffer(); ! if (interfaces != null || javaInterfaces != null) { res.append(keyword); --- 660,667 ---- } ! String printInterfaces(String keyword, List interfaces) { StringBuffer res = new StringBuffer(); ! if (interfaces.size() != 0 || javaInterfaces != null) { res.append(keyword); Index: AbstractInterfaceImplementation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AbstractInterfaceImplementation.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractInterfaceImplementation.java 11 Jun 2004 10:56:55 -0000 1.5 --- AbstractInterfaceImplementation.java 11 Jun 2004 15:53:35 -0000 1.6 *************** *** 65,68 **** --- 65,72 ---- interfaceITF = ident.resolveToItf(typeScope); + ClassDefinition def = ClassDefinition.get(classTC); + if (def != null) + def.addInterfaceImplementation(interfaceITF); + createContext(); } |
From: Daniel B. <bo...@us...> - 2004-06-11 15:53:44
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28516/src/gnu/expr Modified Files: ClassExp.java Log Message: Is is now possible to make a class of an imported package implement an interface defined in the current package (fixes #904327). Index: ClassExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/ClassExp.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ClassExp.java 14 Apr 2004 16:35:35 -0000 1.18 --- ClassExp.java 11 Jun 2004 15:53:35 -0000 1.19 *************** *** 213,216 **** --- 213,221 ---- } + public void recomputeInterfaces() + { + setTypes(); + } + private void setTypes() { *************** *** 234,266 **** superTypes[j++] = t; } ! if (superType == null) ! { ! if (! isSimple()) ! { ! PairClassType ptype = new PairClassType(); ! type = ptype; ! setMakingClassPair(true); ! instanceType = new ClassType(); ! type.setInterface(true); ! ClassType[] interfaces = { type }; ! // Can we better. FIXME. ! instanceType.setSuper(Type.pointer_type); ! instanceType.setInterfaces(interfaces); ! ptype.instanceType = instanceType; ! } ! else ! instanceType = type = new ClassType(getName()); ! type.setSuper(Type.pointer_type); ! } ! else { ! instanceType = type = new ClassType(getName()); ! type.setSuper(superType); } - instanceType.collectable = true; - // Access.SUPER mut be set on all non-interface classes - if (! isInterface()) - accessFlags |= Access.SUPER; - instanceType.setModifiers(accessFlags); if (j > 0) --- 239,278 ---- superTypes[j++] = t; } ! ! // If type is null, we simply want to recompute interfaces ! if (type == null) { ! if (superType == null) ! { ! if (! isSimple()) ! { ! PairClassType ptype = new PairClassType(); ! type = ptype; ! setMakingClassPair(true); ! instanceType = new ClassType(); ! type.setInterface(true); ! ClassType[] interfaces = { type }; ! // Can we better. FIXME. ! instanceType.setSuper(Type.pointer_type); ! instanceType.setInterfaces(interfaces); ! ptype.instanceType = instanceType; ! } ! else ! instanceType = type = new ClassType(getName()); ! type.setSuper(Type.pointer_type); ! } ! else ! { ! System.out.println(getName()); ! instanceType = type = new ClassType(getName()); ! type.setSuper(superType); ! } ! ! instanceType.collectable = true; ! // Access.SUPER mut be set on all non-interface classes ! if (! isInterface()) ! accessFlags |= Access.SUPER; ! instanceType.setModifiers(accessFlags); } if (j > 0) |
From: Daniel B. <bo...@us...> - 2004-06-11 15:53:43
|
Update of /cvsroot/nice/Nice/testsuite/compiler/abstractInterfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28516/testsuite/compiler/abstractInterfaces Modified Files: existingClass.testsuite Log Message: Is is now possible to make a class of an imported package implement an interface defined in the current package (fixes #904327). Index: existingClass.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/abstractInterfaces/existingClass.testsuite,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** existingClass.testsuite 15 Jan 2004 21:39:19 -0000 1.6 --- existingClass.testsuite 11 Jun 2004 15:53:35 -0000 1.7 *************** *** 77,78 **** --- 77,98 ---- // String is not an interface interface java.lang.String implements AI; + + /// PASS + // bug #904327 + // When implementing a non-abstract interface, the class must really + // implement that interface in the bytecode. + + /// package vendor + /// Toplevel + public class Vendor {} + + /// package test import vendor + Vendor a = new Vendor(); + a.vend(); + + /// Toplevel + public interface ITest {} + + public void vend(ITest i){ println("ITest"); } + + class vendor.Vendor implements ITest; |
From: Daniel B. <bo...@us...> - 2004-06-11 10:57:04
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16536/src/bossa/syntax Modified Files: AbstractInterfaceImplementation.java Log Message: Typo. Index: AbstractInterfaceImplementation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AbstractInterfaceImplementation.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractInterfaceImplementation.java 15 Sep 2003 22:29:21 -0000 1.4 --- AbstractInterfaceImplementation.java 11 Jun 2004 10:56:55 -0000 1.5 *************** *** 53,57 **** if (TypeConstructors.isInterface(classTC)) { ! if (!_interface) User.error(this, ""+classTC+" is not an class"); } else --- 53,57 ---- if (TypeConstructors.isInterface(classTC)) { ! if (!_interface) User.error(this, ""+classTC+" is not a class"); } else *************** *** 86,90 **** if (_interface) w.print("interface "); ! else w.print("class "); --- 86,90 ---- if (_interface) w.print("interface "); ! else w.print("class "); |
From: Daniel B. <bo...@us...> - 2004-06-11 05:01:49
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15364/src/gnu/expr Modified Files: Compilation.java Log Message: Correctly generate code for method references from inside custom constructors and instance initializers (fixes #969777). Index: Compilation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/Compilation.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Compilation.java 25 Mar 2004 01:39:52 -0000 1.23 --- Compilation.java 11 Jun 2004 05:01:39 -0000 1.24 *************** *** 1608,1612 **** c.literalTable = literalTable; topLambda = c; ! topClass = (ClassType) c.getType(); c.compileChildMethods(this); } --- 1608,1615 ---- c.literalTable = literalTable; topLambda = c; ! // If the class has outer set, use that as the toplevel class. ! if (c.outer != null) ! topLambda = (LambdaExp) c.outer; ! topClass = (ClassType) topLambda.getType(); c.compileChildMethods(this); } *************** *** 1615,1620 **** { topLambda = c; literalTable = c.literalTable; ! topClass = (ClassType) c.getType(); curClass = topClass; --- 1618,1626 ---- { topLambda = c; + // If the class has outer set, use that as the toplevel class. + if (c.outer != null) + topLambda = (LambdaExp) c.outer; literalTable = c.literalTable; ! topClass = (ClassType) topLambda.getType(); curClass = topClass; |
From: Daniel B. <bo...@us...> - 2004-06-11 05:01:49
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15364/testsuite/compiler/classes Modified Files: initializer.testsuite Log Message: Correctly generate code for method references from inside custom constructors and instance initializers (fixes #969777). Index: initializer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/initializer.testsuite,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** initializer.testsuite 15 Jan 2004 21:39:19 -0000 1.14 --- initializer.testsuite 11 Jun 2004 05:01:39 -0000 1.15 *************** *** 200,201 **** --- 200,218 ---- } } + + /// PASS + let b = new B(); + // Usage of closure inside an instance initializer + /// Toplevel + class A { + void foo() {} + } + + class B extends A { + { + [0].foreach(fst); + this.foo(); + } + } + + void fst(int i) {} |
From: Daniel B. <bo...@us...> - 2004-06-11 05:01:48
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes/constructors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15364/testsuite/compiler/classes/constructors Modified Files: custom.testsuite Log Message: Correctly generate code for method references from inside custom constructors and instance initializers (fixes #969777). Index: custom.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/constructors/custom.testsuite,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** custom.testsuite 22 Dec 2003 20:28:10 -0000 1.10 --- custom.testsuite 11 Jun 2004 05:01:38 -0000 1.11 *************** *** 98,99 **** --- 98,119 ---- A<String> a = new A(x: 5, z: "abc"); A<String> b = new A(str: "5", t: "abc"); + + /// PASS + // bug #969777 + let b = new B(); + // Usage of closure inside a custom constructor + /// Toplevel + class A { + void foo() {} + } + + class B extends A { + void fooB() = this.foo(); + } + + void fst(int i) {} + + new B(int x) { + [x].foreach(fst); + this(); + } |
From: Daniel B. <bo...@us...> - 2004-06-10 13:40:36
|
Update of /cvsroot/nice/Nice/testsuite/compiler/overloading In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18889/testsuite/compiler/overloading Added Files: java.testsuite Log Message: Allow calls to Java methods defined in a Java class that implements several Java interfaces declaring that same method, like java.io.ObjectOutputStream.flush() --- NEW FILE: java.testsuite --- /// PASS // When a Java class implements two interfaces, // there is no ambiguity between methods of the same signature // defined in both interfaces, since they are implemented by the same // method in the class /// Toplevel import java.io.*; void foo(ObjectOutputStream o) { o.flush(); } |
From: Daniel B. <bo...@us...> - 2004-06-10 13:40:36
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18889/src/bossa/syntax Modified Files: OverloadedSymbolExp.java Log Message: Allow calls to Java methods defined in a Java class that implements several Java interfaces declaring that same method, like java.io.ObjectOutputStream.flush() Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** OverloadedSymbolExp.java 26 Feb 2004 22:17:39 -0000 1.68 --- OverloadedSymbolExp.java 10 Jun 2004 13:40:27 -0000 1.69 *************** *** 196,199 **** --- 196,200 ---- removeNonMinimal(symbols, arguments); + removeOverlappingJavaMethods(symbols); if (symbols.size() == 1) *************** *** 523,526 **** --- 524,567 ---- } + /** + When a Java class implements two interfaces, + there is no ambiguity between methods of the same signature + defined in both interfaces, since they are implemented by the same + method in the class. So this method removes all but one of the + overlapping methods. + */ + private static void removeOverlappingJavaMethods(List symbols) + { + // optimization + if(symbols.size()<2) + return; + + int len = symbols.size(); + VarSymbol[] syms = (VarSymbol[]) + symbols.toArray(new VarSymbol[len]); + + for (int i = 0; i < syms.length; i++) + for (int j = i+1; j < syms.length; j++) + if (overlappingJavaMethods(syms[i].getMethodDeclaration(), + syms[j].getMethodDeclaration())) + { + // We can remove either, since they lead to the same implementation + symbols.remove(syms[i]); + // Since we removed i, we don't need to continue this loop. + // This would not be true if we decided to remove j. + break; + } + } + + private static boolean overlappingJavaMethods(MethodDeclaration m1, + MethodDeclaration m2) + { + if (! (m1 instanceof JavaMethod) || + ! (m2 instanceof JavaMethod)) + return false; + + return Arrays.equals(m1.javaArgTypes(), m2.javaArgTypes()); + } + void computeType() { |
From: Daniel B. <bo...@us...> - 2004-06-10 13:40:36
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18889 Modified Files: NEWS Log Message: Allow calls to Java methods defined in a Java class that implements several Java interfaces declaring that same method, like java.io.ObjectOutputStream.flush() Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** NEWS 20 Mar 2004 16:24:15 -0000 1.30 --- NEWS 10 Jun 2004 13:40:28 -0000 1.31 *************** *** 4,7 **** --- 4,10 ---- not make any difference for Nice programs, but simplifies integration with Java tools and usage of Nice code from Java sources. + * Allow calls to Java methods defined in a Java class that implements + several Java interfaces declaring that same method, like + java.io.ObjectOutputStream.flush() -- |
From: Daniel B. <bo...@us...> - 2004-06-09 22:04:36
|
Update of /cvsroot/nice/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24891 Modified Files: maven.xml Added Files: build.properties Log Message: Build the examples using the newly generated compiled version of nice-swing. Index: maven.xml =================================================================== RCS file: /cvsroot/nice/swing/maven.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** maven.xml 5 Feb 2004 15:20:45 -0000 1.1 --- maven.xml 9 Jun 2004 22:04:27 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- <project default="all" + xmlns:ant="jelly:ant" xmlns:j="jelly:core" xmlns:u="jelly:util"> *************** *** 6,16 **** <goal name="all"> ! <attainGoal name="jar:install-snapshot" /> - <!-- - <j:set var="maven.jar.override" value="on" /> - <j:set var="maven.jar.${pom.id}" - value="${maven.build.dir}/${maven.final.name}.jar" /> - --> <j:set var="goal" value="nice" /> <attainGoal name="multiproject:goal" /> --- 7,23 ---- <goal name="all"> ! <attainGoal name="jar:snapshot" /> ! ! <!-- ! The snapshot will be overwritten when satisfying the dependencies ! of the subprojects. So we copy it, and use an override in ! build.properties to make the subprojects use the new version. ! This is a workaround for ! http://jira.codehaus.org/browse/MPMULTIPROJECT-11 ! --> ! <ant:copy ! file="target/${maven.final.name}.jar" ! toFile="target/nice-swing-TEST.jar" /> <j:set var="goal" value="nice" /> <attainGoal name="multiproject:goal" /> --- NEW FILE: build.properties --- // Provide the current version for testing subprojects // This is a workaround for http://jira.codehaus.org/browse/MPMULTIPROJECT-11 maven.jar.override = on maven.jar.nice-swing = ./target/nice-swing-TEST.jar |
From: Daniel B. <bo...@us...> - 2004-06-09 22:04:36
|
Update of /cvsroot/nice/swing/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24891/examples Modified Files: project-template.xml Log Message: Build the examples using the newly generated compiled version of nice-swing. Index: project-template.xml =================================================================== RCS file: /cvsroot/nice/swing/examples/project-template.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** project-template.xml 5 Feb 2004 15:20:45 -0000 1.1 --- project-template.xml 9 Jun 2004 22:04:26 -0000 1.2 *************** *** 63,67 **** <groupId>nice</groupId> <artifactId>nice-swing</artifactId> ! <version>SNAPSHOT</version> <url>http://nice.sf.net/maven</url> <properties> --- 63,67 ---- <groupId>nice</groupId> <artifactId>nice-swing</artifactId> ! <version>TEST</version> <url>http://nice.sf.net/maven</url> <properties> |
From: Daniel B. <bo...@us...> - 2004-06-09 17:02:22
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32031/syntax Modified Files: Pattern.java Log Message: Do not fail when a pattern loaded from a compiled package is not found. This can happen because that class does not exist in the version of the JDK used to load the package. Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** Pattern.java 28 Feb 2004 14:23:43 -0000 1.82 --- Pattern.java 9 Jun 2004 17:02:09 -0000 1.83 *************** *** 775,784 **** if (sym == null) ! User.error("Pattern " + name + " of method " + methodName + ! " is not known"); return new Pattern((TypeConstructor) sym, exact); } /**************************************************************** * Code generation --- 775,787 ---- if (sym == null) ! // This can happen if the class exists only in a later version ! // of the JDK. ! throw new Unknown(); return new Pattern((TypeConstructor) sym, exact); } + public static class Unknown extends RuntimeException {} + /**************************************************************** * Code generation |
From: Daniel B. <bo...@us...> - 2004-06-09 17:02:22
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32031/link Modified Files: ImportedAlternative.java Log Message: Do not fail when a pattern loaded from a compiled package is not found. This can happen because that class does not exist in the version of the JDK used to load the package. Index: ImportedAlternative.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/ImportedAlternative.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ImportedAlternative.java 28 Feb 2004 14:23:43 -0000 1.8 --- ImportedAlternative.java 9 Jun 2004 17:02:11 -0000 1.9 *************** *** 59,87 **** ArrayList patterns = new ArrayList(5); ! Pattern p; ! while ((p = Pattern.read(rep, at, fullName)) != null) ! { ! if (p.getTC() == bossa.syntax.PrimitiveType.arrayTC) ! /* Special treatment for arrays: ! they are compiled into Object, ! but we want a SpecialArray in the method bytecode type. ! */ ! { ! int argnum = patterns.size(); ! if (method.arg_types[argnum] == Type.pointer_type) ! method.arg_types[argnum] = SpecialArray.unknownTypeArray(); ! } ! patterns.add(p); ! } ! ! Alternative alt = ! new ImportedAlternative(method.getName(), (Pattern[]) ! patterns.toArray(new Pattern[patterns.size()]), ! new QuoteExp(new PrimProcedure(method)), ! location); ! alt.add(nice.tools.util.System.split ! (fullName, MethodDeclaration.methodListSeparator)); } --- 59,93 ---- ArrayList patterns = new ArrayList(5); ! try { ! Pattern p; ! while ((p = Pattern.read(rep, at, fullName)) != null) ! { ! if (p.getTC() == bossa.syntax.PrimitiveType.arrayTC) ! /* Special treatment for arrays: ! they are compiled into Object, ! but we want a SpecialArray in the method bytecode type. ! */ ! { ! int argnum = patterns.size(); ! if (method.arg_types[argnum] == Type.pointer_type) ! method.arg_types[argnum] = SpecialArray.unknownTypeArray(); ! } ! patterns.add(p); ! } ! Alternative alt = ! new ImportedAlternative(method.getName(), (Pattern[]) ! patterns.toArray(new Pattern[patterns.size()]), ! new QuoteExp(new PrimProcedure(method)), ! location); ! ! alt.add(nice.tools.util.System.split ! (fullName, MethodDeclaration.methodListSeparator)); ! } ! catch(Pattern.Unknown ex) { ! // This can happen if the class exists only in a later version ! // of the JDK. We just ignore this alternative. ! } } |
From: Daniel B. <bo...@us...> - 2004-06-09 14:44:16
|
Update of /cvsroot/nice/Nice/src/nice/tools/maven In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23986 Modified Files: plugin.jelly Log Message: Cleanup. Do not use replaceAll, as that fails on JDK 1.3. Index: plugin.jelly =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/maven/plugin.jelly,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** plugin.jelly 14 Feb 2004 21:07:09 -0000 1.1 --- plugin.jelly 9 Jun 2004 14:44:05 -0000 1.2 *************** *** 16,20 **** <!-- Give a warning if sources were not found, to let the user know ! what's (not) happening. --> <nice:ifNotNeeded> --- 16,20 ---- <!-- Give a warning if sources were not found, to let the user know ! what's (not) happening. --> <nice:ifNotNeeded> *************** *** 150,154 **** <goal name="nice:jar-resources" description="Copy any resources that must be present in the deployed JAR file"> ! <j:if test="${!pom.build.resources.isEmpty()}"> <maven:copy-resources --- 150,154 ---- <goal name="nice:jar-resources" description="Copy any resources that must be present in the deployed JAR file"> ! <j:if test="${!pom.build.resources.isEmpty()}"> <maven:copy-resources *************** *** 157,161 **** </j:if> </goal> ! <define:taglib uri="nice"> <define:tag name="dependency-handle"> --- 157,161 ---- </j:if> </goal> ! <define:taglib uri="nice"> <define:tag name="dependency-handle"> *************** *** 212,217 **** --> ! <j:set var="mainPkgDir" ! value="${pom.build.sourceDirectory}/${pom.package.replaceAll('\.', '/')}"/> <util:available file="${mainPkgDir}"> --- 212,219 ---- --> ! <j:set var="mainPkgDir" value="${pom.package}" /> ! <util:replace var="mainPkgDir" ! oldChar="." newChar="/" value="${mainPkgDir}" /> ! <j:set var="mainPkgDir" value="${pom.build.sourceDirectory}/${mainPkgDir}"/> <util:available file="${mainPkgDir}"> |
From: Daniel B. <bo...@us...> - 2004-06-09 12:25:51
|
Update of /cvsroot/nice/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3656 Modified Files: project.properties Log Message: cvs.nice.sourceforge.net does not seem to work anymore, using cvs.sourceforge.net instead. Index: project.properties =================================================================== RCS file: /cvsroot/nice/swing/project.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** project.properties 5 Feb 2004 16:17:14 -0000 1.2 --- project.properties 9 Jun 2004 12:25:42 -0000 1.3 *************** *** 12,15 **** maven.scm.method = cvs maven.scm.cvs.rsh = ssh ! maven.scm.cvs.root = :ext:${maven.username}@cvs.nice.sourceforge.net:/cvsroot/nice maven.scm.cvs.module = swing --- 12,15 ---- maven.scm.method = cvs maven.scm.cvs.rsh = ssh ! maven.scm.cvs.root = :ext:${maven.username}@cvs.sourceforge.net:/cvsroot/nice maven.scm.cvs.module = swing |