src/share/classes/com/sun/tools/javac/jvm/Target.java

changeset 1646
a4913ea9bb62
parent 1569
475eb15dfdad
child 2525
2eb010b6cb22
equal deleted inserted replaced
1645:97f6839673d6 1646:a4913ea9bb62
1 /* 1 /*
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
45 JDK1_2("1.2", 46, 0), 45 JDK1_2("1.2", 46, 0),
46 JDK1_3("1.3", 47, 0), 46 JDK1_3("1.3", 47, 0),
47 47
48 /** J2SE1.4 = Merlin. */ 48 /** J2SE1.4 = Merlin. */
49 JDK1_4("1.4", 48, 0), 49 JDK1_4("1.4", 48, 0),
50
51 /** Support for the JSR14 prototype compiler (targeting 1.4 VMs
52 * augmented with a few support classes). This is a transitional
53 * option that will not be supported in the product. */
54 JSR14("jsr14", 48, 0),
55
56 /** The following are undocumented transitional targets that we
57 * had used to test VM fixes in update releases. We do not
58 * promise to retain support for them. */
59 JDK1_4_1("1.4.1", 48, 0),
60 JDK1_4_2("1.4.2", 48, 0),
61 50
62 /** Tiger. */ 51 /** Tiger. */
63 JDK1_5("1.5", 49, 0), 52 JDK1_5("1.5", 49, 0),
64 53
65 /** JDK 6. */ 54 /** JDK 6. */
173 */ 162 */
174 public boolean interfaceObjectOverridesBinaryCompatibility() { 163 public boolean interfaceObjectOverridesBinaryCompatibility() {
175 return compareTo(JDK1_5) >= 0; 164 return compareTo(JDK1_5) >= 0;
176 } 165 }
177 166
178 /** Beginning in -target 1.4.2, we make synthetic variables 167 /** Beginning in -target 1.5, we make synthetic variables
179 * package-private instead of private. This is to prevent the 168 * package-private instead of private. This is to prevent the
180 * necessity of access methods, which effectively relax the 169 * necessity of access methods, which effectively relax the
181 * protection of the field but bloat the class files and affect 170 * protection of the field but bloat the class files and affect
182 * execution. 171 * execution.
183 */ 172 */
184 public boolean usePrivateSyntheticFields() { 173 public boolean usePrivateSyntheticFields() {
185 return compareTo(JDK1_4_2) < 0; 174 return compareTo(JDK1_5) < 0;
186 } 175 }
187 176
188 /** Sometimes we need to create a field to cache a value like a 177 /** Sometimes we need to create a field to cache a value like a
189 * class literal of the assertions flag. In -target 1.4.2 and 178 * class literal of the assertions flag. In -target 1.5 and
190 * later we create a new synthetic class for this instead of 179 * later we create a new synthetic class for this instead of
191 * using the outermost class. See 4401576. 180 * using the outermost class. See 4401576.
192 */ 181 */
193 public boolean useInnerCacheClass() { 182 public boolean useInnerCacheClass() {
194 return compareTo(JDK1_4_2) >= 0; 183 return compareTo(JDK1_5) >= 0;
195 } 184 }
196 185
197 /** Return true if cldc-style stack maps need to be generated. */ 186 /** Return true if cldc-style stack maps need to be generated. */
198 public boolean generateCLDCStackmap() { 187 public boolean generateCLDCStackmap() {
199 return false; 188 return false;
274 /** Although we may not have support for class literals, should we 263 /** Although we may not have support for class literals, should we
275 * avoid initializing the class that the literal refers to? 264 * avoid initializing the class that the literal refers to?
276 * See 4468823 265 * See 4468823
277 */ 266 */
278 public boolean classLiteralsNoInit() { 267 public boolean classLiteralsNoInit() {
279 return compareTo(JDK1_4_2) >= 0; 268 return compareTo(JDK1_5) >= 0;
280 } 269 }
281 270
282 /** Although we may not have support for class literals, when we 271 /** Although we may not have support for class literals, when we
283 * throw a NoClassDefFoundError, should we initialize its cause? 272 * throw a NoClassDefFoundError, should we initialize its cause?
284 */ 273 */
298 */ 287 */
299 public boolean hasIterable() { 288 public boolean hasIterable() {
300 return compareTo(JDK1_5) >= 0; 289 return compareTo(JDK1_5) >= 0;
301 } 290 }
302 291
303 /** For bootstrapping javac only, we do without java.lang.Enum if
304 * necessary.
305 */
306 public boolean compilerBootstrap(Symbol c) {
307 return
308 this == JSR14 &&
309 (c.flags() & Flags.ENUM) != 0 &&
310 c.flatName().toString().startsWith("com.sun.tools.")
311 // && !Target.class.getSuperclass().getName().equals("java.lang.Enum")
312 ;
313 }
314
315 /** In J2SE1.5.0, we introduced the "EnclosingMethod" attribute 292 /** In J2SE1.5.0, we introduced the "EnclosingMethod" attribute
316 * for improved reflection support. 293 * for improved reflection support.
317 */ 294 */
318 public boolean hasEnclosingMethodAttribute() { 295 public boolean hasEnclosingMethodAttribute() {
319 return compareTo(JDK1_5) >= 0 || this == JSR14; 296 return compareTo(JDK1_5) >= 0;
320 } 297 }
321 } 298 }

mercurial