JavaCompiler_Eclipse.st
author hlopkmar
Fri, 30 Nov 2012 20:52:11 +0000
branchdevelopment
changeset 1844 7f4dd9a13c2c
parent 1818 2e5ed72e7dfd
child 1864 60a8dc26c8c6
permissions -rw-r--r--
disabling multibyte char disassempler test as stderr cannot write multibyte chars and hudson reports error
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     1
"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     3
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     4
 New code and modifications done at SWING Research Group [1]:
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     5
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     6
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     7
                            SWING Research Group, Czech Technical University in Prague
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     8
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
     9
 This software is furnished under a license and may be used
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    14
 hereby transferred.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    15
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    16
 [1] Code written at SWING Research Group contains a signature
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    17
     of one of the above copright owners. For exact set of such code,
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    18
     see the differences between this version and version stx:libjava
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    19
     as of 1.9.2010
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    20
"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    21
"{ Package: 'stx:libjava' }"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    22
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    23
Object subclass:#JavaCompiler_Eclipse
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    24
	instanceVariableNames:''
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    25
	classVariableNames:'ECJCompilerClass'
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    26
	poolDictionaries:''
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    27
	category:'Languages-Java-Tools-Eclipse'
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    28
!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    29
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    30
!JavaCompiler_Eclipse class methodsFor:'documentation'!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    31
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    32
copyright
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    33
"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    34
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    35
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    36
 New code and modifications done at SWING Research Group [1]:
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    37
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    38
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    39
                            SWING Research Group, Czech Technical University in Prague
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    40
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    41
 This software is furnished under a license and may be used
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    42
 only in accordance with the terms of that license and with the
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    44
 be provided or otherwise made available to, or used by, any
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    45
 other person.  No title to or ownership of the software is
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    46
 hereby transferred.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    47
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    48
 [1] Code written at SWING Research Group contains a signature
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    49
     of one of the above copright owners. For exact set of such code,
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    50
     see the differences between this version and version stx:libjava
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    51
     as of 1.9.2010
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    52
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    53
"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    54
!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    55
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    56
history
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    57
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    58
    "Created: / 02-04-2012 / 10:35:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    59
    "Created: #initialize / 02-04-2012 / 10:46:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    60
    "Created: #initCompiler: / 02-04-2012 / 13:16:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    61
    "Created: #compilerEnvironment / 02-04-2012 / 13:18:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    62
    "Created: #compile: / 02-04-2012 / 13:21:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    63
! !
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    64
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    65
!JavaCompiler_Eclipse class methodsFor:'compiling'!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    66
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    67
compile: compilationUnit 
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    68
    ^self new compile: compilationUnit.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    69
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    70
    "Created: / 02-04-2012 / 13:21:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    71
! !
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    72
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    73
!JavaCompiler_Eclipse methodsFor:'compiling'!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    74
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    75
compilationResultFor: compilationUnit 
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
    76
    ^ (Java classForName: 'org.eclipse.jdt.internal.compiler.CompilationResult') 
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
    77
        new: compilationUnit
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
    78
        with: 0
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
    79
        with: 0
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
    80
        with: 0.
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    81
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
    82
    "Modified: / 03-04-2012 / 12:39:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    83
!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    84
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    85
compile: compilationUnit 
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    86
    | compiler  compEnv  policy  options  requestor  problemFactory |
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    87
    compEnv := self compilerEnvironment.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    88
    policy := self policy.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    89
    options := self compilerOptions.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    90
    requestor := self compilationResultFor: compilationUnit.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    91
    problemFactory := self problemFactory.
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
    92
     "Do not use cached Java class - think about #flushAllJavaResources"
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
    93
    compiler := (JAVA org eclipse jdt internal compiler Compiler) 
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    94
            new: compEnv
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    95
            with: policy
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    96
            with: options
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    97
            with: requestor
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    98
            with: problemFactory.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
    99
    compiler compile: compilationUnit.
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   100
    self breakPoint: #mh.
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   101
    ^ requestor getClassFiles.
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   102
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   103
    "Created: / 02-04-2012 / 13:18:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1448
4c9fd027d2d4 Fixes in JavaCompiler_Eclipse
vranyj1
parents: 1447
diff changeset
   104
    "Modified: / 02-04-2012 / 18:42:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   105
    "Modified (format): / 03-04-2012 / 11:49:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   106
!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   107
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   108
compilerEnvironment
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   109
    ^ (JAVA stx libjava tools LibjavaCompilerEnv) new.
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   110
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   111
    "Created: / 02-04-2012 / 13:18:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   112
!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   113
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   114
compilerOptions
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   115
    ^ (Java classForName: 'org.eclipse.jdt.internal.compiler.impl.CompilerOptions') new.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   116
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   117
    "Modified: / 03-04-2012 / 12:40:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   118
!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   119
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   120
policy
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   121
    ^ (Java classForName: 'org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies') 
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   122
        exitOnFirstError.
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   123
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   124
    "Modified: / 03-04-2012 / 12:39:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   125
!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   126
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   127
problemFactory
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   128
    ^ (JAVA
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   129
        org eclipse jdt internal compiler problem DefaultProblemFactory) 
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   130
            new.
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   131
1449
797c2aa3bbce java compiler work
hlopkmar
parents: 1448
diff changeset
   132
    "Modified: / 03-04-2012 / 12:27:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1447
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   133
! !
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   134
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   135
!JavaCompiler_Eclipse class methodsFor:'documentation'!
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   136
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   137
version_SVN
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   138
    ^ '$Id::                                                                                                                        $'
6117c519ea54 initial (non working) attempt for ecj compiler
hlopkmar
parents:
diff changeset
   139
! !