JavaLanguage.st
changeset 2353 fa7400d022a0
parent 2161 8a855ca6cd04
child 2380 9195eccdcbd9
child 2396 fadc6d7a2f5b
--- a/JavaLanguage.st	Sat Feb 02 01:23:18 2013 +0100
+++ b/JavaLanguage.st	Sat Feb 16 19:08:45 2013 +0100
@@ -1,11 +1,11 @@
 "
  COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                             SWING Research Group, Czech Technical University in Prague
 
- Parts of the code written by Claus Gittinger are under following
- license:
-
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
  inclusion of the above copyright notice.   This software may not
@@ -13,31 +13,10 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 
- Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the 'Software'), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- [1] Code written at SWING Research Group contain a signature
-     of one of the above copright owners.
+ [1] Code written at SWING Research Group contains a signature
+     of one of the above copright owners. For exact set of such code,
+     see the differences between this version and version stx:libjava
+     as of 1.9.2010
 "
 "{ Package: 'stx:libjava' }"
 
@@ -53,12 +32,12 @@
 copyright
 "
  COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                             SWING Research Group, Czech Technical University in Prague
 
- Parts of the code written by Claus Gittinger are under following
- license:
-
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
  inclusion of the above copyright notice.   This software may not
@@ -66,31 +45,10 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 
- Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the 'Software'), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- [1] Code written at SWING Research Group contain a signature
-     of one of the above copright owners.
+ [1] Code written at SWING Research Group contains a signature
+     of one of the above copright owners. For exact set of such code,
+     see the differences between this version and version stx:libjava
+     as of 1.9.2010
 
 "
 ! !
@@ -128,17 +86,23 @@
 
 compilerClass
     "Answer a class suitable for compiling a source code in 'my' language"
+    
+    (OperatingSystem getLoginName = 'm') ifTrue: [ ^ ByteCodeCompiler ].
+    ^ GroovyCompiler "No Java compiler yet :-("
 
-    ^ nil "No Java compiler yet"
-
-    "Modified: / 26-10-2010 / 23:41:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 04-04-2012 / 22:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 02-12-2012 / 14:36:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
 
 evaluatorClass
-
-    ^JavaEvaluator
+    "There is no evaluator for Java. If you would like to
+     evaluate Java code, use GroovyEvaluator instead"
+    
+    (OperatingSystem getLoginName = 'm') ifTrue: [ ^ Parser ].
+    ^ GroovyEvaluator
 
     "Created: / 16-08-2011 / 10:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-12-2012 / 14:37:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
 
 lookupClass
@@ -170,27 +134,89 @@
     ^ JavaSourceFileWriter
 
     "Modified: / 27-10-2010 / 18:42:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+syntaxHighlighterClass
+    "Answers a class used by browser and debugger to colorze code.
+     It is OK to return nil, which means that the code is shown as-is"
+
+    "return nil by default"
+"/    ^nil
+    ^JavaSyntaxHighlighter
+"/    ^ JavaSyntaxHighlighter_Old
+
+    "Created: / 11-02-2012 / 18:11:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaLanguage methodsFor:'queries'!
 
 supportsExtensionMethods
+    "
+      Answer true iff this language supports extension methods, i.e., if the language
+      can provide extension methods for another class (not necessarily of the same language
+    "
 
     ^false
 
-    "Created: / 19-03-2011 / 10:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 06-09-2012 / 12:09:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLanguage methodsFor:'testing'!
+
+isJava
+    "true iff this is the Java language"
+
+    ^ true
+
+    "Created: / 15-12-2011 / 23:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isJavaLike
+    "true if receiver is kind of Java language (based on Java)"
+
+    ^ true
+
+    "Created: / 13-04-2012 / 17:48:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLanguage methodsFor:'utilities - source code'!
+
+classTemplateFor: superClass in: category asNamespace: isNamespace private: isPrivate
+    | sclass |
+
+    self assert: isNamespace not.
+    self assert: ((superClass == Object) or:[superClass isJavaClass]).
+
+    sclass := superClass == Object ifTrue:[Java classForName:'java.lang.Object'] ifFalse:[superClass].
+
+    ^'//import stx.libjava.annotations.Category;
+//@Category("%(CATEGORY)")
+%(ACCESS) class %(NAME) extends %(SNAME) {
+    /* fields and methods here... */
+}
+' expandPlaceholdersWith:
+        (Dictionary new
+            at: 'CATEGORY' put: category;
+            at: 'ACCESS' put: (isPrivate ifTrue:['protected'] ifFalse:['public']);
+            at: 'NAME' put: 'NewClass';
+            at: 'SNAME' put: sclass javaName;
+            yourself)
+
+    "Created: / 18-02-2012 / 18:27:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaLanguage class methodsFor:'documentation'!
 
-version
-    ^ '$Header: /cvs/stx/stx/libjava/JavaLanguage.st,v 1.2 2011-09-29 11:15:50 vrany Exp $'
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libjava/JavaLanguage.st,v 1.3 2013-02-16 18:08:32 vrany Exp $'
 !
 
-version_CVS
-    ^ '$Header: /cvs/stx/stx/libjava/JavaLanguage.st,v 1.2 2011-09-29 11:15:50 vrany Exp $'
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 !
 
 version_SVN
-    ^ '§Id: JavaLanguage.st 1262 2011-08-16 11:52:34Z vranyj1 §'
+    ^ '§Id§'
 ! !
+