src/GroovyCompiler.st
author vranyj1
Tue, 28 Feb 2012 12:57:53 +0000
branchjk_new_structure
changeset 1388 71a9ff13de80
parent 1387 4c609318f0e5
child 1441 0faa0f8eda0c
permissions -rw-r--r--
Improvements in interop
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     1
"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     3
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     4
 New code and modifications done at SWING Research Group [1]:
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     5
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     6
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     7
                            SWING Research Group, Czech Technical University in Prague
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     8
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
     9
 This software is furnished under a license and may be used
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    14
 hereby transferred.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    15
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    16
 [1] Code written at SWING Research Group contains a signature
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    17
     of one of the above copright owners. For exact set of such code,
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    18
     see the differences between this version and version stx:libjava
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    19
     as of 1.9.2010
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    20
"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    21
"{ Package: 'stx:libjava' }"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    22
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    23
Object subclass:#GroovyCompiler
1387
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    24
	instanceVariableNames:'requestor'
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    25
	classVariableNames:'GroovyClassLoader'
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    26
	poolDictionaries:''
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    27
	category:'Languages-Groovy-Compiler'
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    28
!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    29
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    30
!GroovyCompiler class methodsFor:'documentation'!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    31
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    32
copyright
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    33
"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    34
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    35
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    36
 New code and modifications done at SWING Research Group [1]:
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    37
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    38
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    39
                            SWING Research Group, Czech Technical University in Prague
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    40
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    41
 This software is furnished under a license and may be used
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    42
 only in accordance with the terms of that license and with the
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    44
 be provided or otherwise made available to, or used by, any
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    45
 other person.  No title to or ownership of the software is
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    46
 hereby transferred.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    47
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    48
 [1] Code written at SWING Research Group contains a signature
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    49
     of one of the above copright owners. For exact set of such code,
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    50
     see the differences between this version and version stx:libjava
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    51
     as of 1.9.2010
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    52
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    53
"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    54
! !
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    55
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    56
!GroovyCompiler class methodsFor:'initialization'!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    57
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    58
flushGroovyClassLoader
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    59
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    60
    GroovyClassLoader := nil
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    61
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    62
    "Created: / 18-02-2012 / 22:25:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    63
! !
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    64
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    65
!GroovyCompiler class methodsFor:'instance creation'!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    66
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    67
new
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    68
    "return an initialized instance"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    69
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    70
    ^ self basicNew initialize.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    71
! !
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    72
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    73
!GroovyCompiler class methodsFor:'compiler interface'!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    74
1388
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    75
compile: source
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    76
    "Compiles a new Groovy class given the source code"
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    77
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    78
    ^self new compile: source.
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    79
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    80
    "Created: / 27-02-2012 / 23:27:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    81
!
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    82
1372
dea574a1b6b3 Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents: 1368
diff changeset
    83
compile: source forClass: class inCategory: category notifying: requestor install: doInstall
dea574a1b6b3 Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents: 1368
diff changeset
    84
dea574a1b6b3 Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents: 1368
diff changeset
    85
    "We allways compile whole class"
dea574a1b6b3 Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents: 1368
diff changeset
    86
1387
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    87
    ^self new
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    88
        requestor: requestor;
1388
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
    89
        compile: source.
1372
dea574a1b6b3 Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents: 1368
diff changeset
    90
dea574a1b6b3 Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents: 1368
diff changeset
    91
    "Created: / 21-02-2012 / 11:10:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    92
! !
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
    93
1387
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    94
!GroovyCompiler methodsFor:'accessing'!
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    95
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    96
requestor
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    97
    ^ requestor
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    98
!
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
    99
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   100
requestor:something
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   101
    requestor := something.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   102
! !
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   103
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   104
!GroovyCompiler methodsFor:'compiler interface'!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   105
1388
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
   106
compile: source
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   107
    "Compiles a new Groovy class given the source code"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   108
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   109
    | jclass class |    
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   110
1387
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   111
    [
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   112
        jclass := GroovyClassLoader 
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   113
                    perform: #'parseClass(Ljava/lang/String;)Ljava/lang/Class;'
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   114
                       with: (Java as_String: source).
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   115
    ] on: JavaError do:[:jex|
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   116
        self handleException: jex.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   117
    ].
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   118
    jclass isNil ifTrue:[ ^ nil ].
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   119
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   120
    class := JavaVM classForJavaClassObject: jclass.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   121
    class setSource: source.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   122
    ^class.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   123
1388
71a9ff13de80 Improvements in interop
vranyj1
parents: 1387
diff changeset
   124
    "Created: / 27-02-2012 / 23:27:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   125
! !
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   126
1387
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   127
!GroovyCompiler methodsFor:'error reporting'!
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   128
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   129
error: message line: line from: start to: end
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   130
    "notify requestor of an error - if there is no requestor
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   131
     put it on the transcript. Requestor is typically the CodeView
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   132
     in which the accept/doIt was triggered, or the PositionableStream
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   133
     which does the fileIn. The requestor may decide how to highlight the
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   134
     error (and/or to abort the compile).
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   135
     Return the result passed back by the requestor."
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   136
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   137
    |err|
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   138
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   139
    Smalltalk isInitialized ifFalse:[
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   140
        Smalltalk isStandAloneDebug ifTrue:[
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   141
            "/ error during startup
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   142
            thisContext fullPrintAll.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   143
        ]
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   144
    ].
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   145
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   146
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   147
    "/ backward compatibility - will vanish eventually (use a handler, Luke)
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   148
    requestor notNil ifTrue:[
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   149
        requestor error:message position:start to:end from:self.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   150
        ^ self
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   151
    ].
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   152
    Parser::ParseError isHandled ifTrue:[
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   153
        err := Parser::ParseError new.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   154
        err errorMessage: message startPosition: start endPosition: end.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   155
        err parameter:self.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   156
        err lineNumber:line.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   157
        err raiseRequest.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   158
        ^ self
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   159
    ].
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   160
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   161
    "Created: / 27-02-2012 / 21:10:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   162
!
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   163
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   164
handleException: javaError
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   165
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   166
    | errors cause |
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   167
             "Arggghhh...that's Javas' clean OO design, sigh."
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   168
    errors := javaError parameter getErrorCollector getErrors.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   169
    cause := errors getFirst getCause.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   170
    self 
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   171
        error:  javaError parameter getMessage
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   172
         line: cause getLine
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   173
         from: cause getStartColumn
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   174
           to: cause getEndColumn.
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   175
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   176
    "Created: / 27-02-2012 / 21:09:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   177
! !
4c609318f0e5 - Improvements in GroovyCompiler (error handling)
vranyj1
parents: 1385
diff changeset
   178
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   179
!GroovyCompiler methodsFor:'initialization'!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   180
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   181
initialize
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   182
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   183
    self initializeGroovyClassLoader
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   184
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   185
    "Modified: / 18-02-2012 / 19:18:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   186
!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   187
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   188
initializeGroovyClassLoader
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   189
    | groovy_lang_GroovyClassLoader |
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   190
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   191
    GroovyClassLoader notNil ifTrue:[ ^ self ].
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   192
1385
3426388640da Improvements in interop
vranyj1
parents: 1372
diff changeset
   193
    JavaVM booted ifFalse:[ JavaVM boot ].
1372
dea574a1b6b3 Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents: 1368
diff changeset
   194
    groovy_lang_GroovyClassLoader := Java classForName:'stx.libjava.groovy.GroovyClassLoader'.
1368
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   195
    GroovyClassLoader := groovy_lang_GroovyClassLoader newCleared.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   196
    GroovyClassLoader
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   197
            perform: #'<init>(Ljava/lang/ClassLoader;)V'
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   198
               with: JavaVM systemClassLoader.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   199
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   200
    "
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   201
        GroovyClassLoader 
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   202
        GroovyCompiler basicNew initializeGroovyClassLoader.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   203
        GroovyClassLoader := nil.
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   204
    "
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   205
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   206
    "Created: / 18-02-2012 / 19:14:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   207
! !
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   208
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   209
!GroovyCompiler class methodsFor:'documentation'!
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   210
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   211
version_SVN
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   212
    ^ '$Id$'
5f502e712403 Groovy language support and integration
vranyj1
parents:
diff changeset
   213
! !