author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 16 Jan 2013 16:32:33 +0000 | |
branch | refactoring-vmdata |
changeset 1967 | cc28bbc7c624 |
parent 1864 | 60a8dc26c8c6 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
877 | 20 |
" |
752 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
23 |
ProgrammingLanguage subclass:#JavaLanguage |
|
24 |
instanceVariableNames:'' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Support' |
|
28 |
! |
|
29 |
||
877 | 30 |
!JavaLanguage class methodsFor:'documentation'! |
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
877 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
1155 | 48 |
[1] Code written at SWING Research Group contains a signature |
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
1152 | 51 |
as of 1.9.2010 |
877 | 52 |
|
53 |
" |
|
54 |
! ! |
|
752 | 55 |
|
56 |
!JavaLanguage methodsFor:'accessing'! |
|
57 |
||
58 |
lookup |
|
59 |
||
60 |
^Lookup builtin |
|
61 |
||
62 |
"Created: / 17-03-2011 / 14:23:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
63 |
! |
|
64 |
||
65 |
name |
|
66 |
"Answers a human-readable name of myself: |
|
67 |
'Smalltalk' for SmalltalkLanguage, |
|
68 |
'Ruby' for RubyLanguage |
|
69 |
..." |
|
70 |
||
71 |
^ 'Java' |
|
72 |
||
73 |
"Modified: / 26-10-2010 / 23:40:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
74 |
! |
|
75 |
||
76 |
sourceFileSuffix |
|
77 |
"Answers a default suffix for source files, i.e. 'st' for Smalltalk, |
|
78 |
'js' for JavaScript or 'rb' for Ruby', etc." |
|
79 |
||
80 |
^ 'java' |
|
81 |
||
82 |
"Modified: / 26-10-2010 / 23:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
83 |
! ! |
|
84 |
||
85 |
!JavaLanguage methodsFor:'accessing - classes'! |
|
86 |
||
87 |
compilerClass |
|
88 |
"Answer a class suitable for compiling a source code in 'my' language" |
|
1853 | 89 |
|
90 |
(OperatingSystem getLoginName = 'm') ifTrue: [ ^ ByteCodeCompiler ]. |
|
1455 | 91 |
^ GroovyCompiler "No Java compiler yet :-(" |
752 | 92 |
|
1455 | 93 |
"Modified (comment): / 04-04-2012 / 22:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1853 | 94 |
"Modified (format): / 02-12-2012 / 14:36:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 95 |
! |
96 |
||
917 | 97 |
evaluatorClass |
1368 | 98 |
"There is no evaluator for Java. If you would like to |
99 |
evaluate Java code, use GroovyEvaluator instead" |
|
1853 | 100 |
|
101 |
(OperatingSystem getLoginName = 'm') ifTrue: [ ^ Parser ]. |
|
102 |
^ GroovyEvaluator |
|
917 | 103 |
|
104 |
"Created: / 16-08-2011 / 10:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1853 | 105 |
"Modified: / 02-12-2012 / 14:37:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
917 | 106 |
! |
107 |
||
752 | 108 |
lookupClass |
109 |
||
110 |
^JavaLookup |
|
111 |
||
112 |
"Created: / 17-03-2011 / 14:08:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
113 |
! |
|
114 |
||
115 |
parserClass |
|
116 |
"Answer a class suitable for parsing a source code in 'my' language" |
|
117 |
||
118 |
^ nil "No Java parser yet" |
|
119 |
||
120 |
"Modified: / 26-10-2010 / 23:41:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
121 |
! |
|
122 |
||
123 |
sourceFileReaderClass |
|
124 |
"Answers a class that can be used for reading & compiling source files" |
|
125 |
||
126 |
^ nil "No Java compiler yet" |
|
127 |
||
128 |
"Modified: / 26-10-2010 / 23:41:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
129 |
! |
|
130 |
||
131 |
sourceFileWriterClass |
|
132 |
"Answers a class is used for source file writing (i.e. file-out)" |
|
133 |
||
134 |
^ JavaSourceFileWriter |
|
135 |
||
136 |
"Modified: / 27-10-2010 / 18:42:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1356
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
137 |
! |
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
138 |
|
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
139 |
syntaxHighlighterClass |
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
140 |
"Answers a class used by browser and debugger to colorze code. |
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
141 |
It is OK to return nil, which means that the code is shown as-is" |
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
142 |
|
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
143 |
"return nil by default" |
1400 | 144 |
"/ ^nil |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1405
diff
changeset
|
145 |
^JavaSyntaxHighlighter |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1405
diff
changeset
|
146 |
"/ ^ JavaSyntaxHighlighter_Old |
1356
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
147 |
|
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
148 |
"Created: / 11-02-2012 / 18:11:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 149 |
! ! |
150 |
||
151 |
!JavaLanguage methodsFor:'queries'! |
|
152 |
||
153 |
supportsExtensionMethods |
|
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
154 |
" |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
155 |
Answer true iff this language supports extension methods, i.e., if the language |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
156 |
can provide extension methods for another class (not necessarily of the same language |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
157 |
" |
752 | 158 |
|
159 |
^false |
|
160 |
||
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
161 |
"Created: / 06-09-2012 / 12:09:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 162 |
! ! |
163 |
||
1288 | 164 |
!JavaLanguage methodsFor:'testing'! |
165 |
||
166 |
isJava |
|
167 |
"true iff this is the Java language" |
|
168 |
||
169 |
^ true |
|
170 |
||
171 |
"Created: / 15-12-2011 / 23:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1478 | 172 |
! |
173 |
||
174 |
isJavaLike |
|
175 |
"true if receiver is kind of Java language (based on Java)" |
|
176 |
||
177 |
^ true |
|
178 |
||
179 |
"Created: / 13-04-2012 / 17:48:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1288 | 180 |
! ! |
181 |
||
1453 | 182 |
!JavaLanguage methodsFor:'utilities - source code'! |
183 |
||
184 |
classTemplateFor: superClass in: category asNamespace: isNamespace private: isPrivate |
|
185 |
| sclass | |
|
186 |
||
187 |
self assert: isNamespace not. |
|
188 |
self assert: ((superClass == Object) or:[superClass isJavaClass]). |
|
189 |
||
190 |
sclass := superClass == Object ifTrue:[Java classForName:'java.lang.Object'] ifFalse:[superClass]. |
|
191 |
||
192 |
^'//import stx.libjava.annotations.Category; |
|
193 |
//@Category("%(CATEGORY)") |
|
194 |
%(ACCESS) class %(NAME) extends %(SNAME) { |
|
195 |
/* fields and methods here... */ |
|
196 |
} |
|
197 |
' expandPlaceholdersWith: |
|
198 |
(Dictionary new |
|
199 |
at: 'CATEGORY' put: category; |
|
200 |
at: 'ACCESS' put: (isPrivate ifTrue:['protected'] ifFalse:['public']); |
|
201 |
at: 'NAME' put: 'NewClass'; |
|
202 |
at: 'SNAME' put: sclass javaName; |
|
203 |
yourself) |
|
204 |
||
205 |
"Created: / 18-02-2012 / 18:27:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
206 |
! ! |
|
207 |
||
752 | 208 |
!JavaLanguage class methodsFor:'documentation'! |
209 |
||
1864 | 210 |
version_HG |
211 |
||
212 |
^ '$Changeset: <not expanded> $' |
|
213 |
! |
|
214 |
||
752 | 215 |
version_SVN |
1864 | 216 |
^ '§Id§' |
752 | 217 |
! ! |