Source Code Cross Referenced for Source.java in  » 6.0-JDK-Modules-com.sun » tools » com » sun » tools » javac » code » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » tools » com.sun.tools.javac.code 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package com.sun.tools.javac.code;
027:
028:        import com.sun.tools.javac.util.*;
029:        import com.sun.tools.javac.jvm.Target;
030:        import javax.lang.model.SourceVersion;
031:        import static javax.lang.model.SourceVersion.*;
032:        import java.util.*;
033:
034:        /** The source language version accepted.
035:         *
036:         *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
037:         *  you write code that depends on this, you do so at your own risk.
038:         *  This code and its internal interfaces are subject to change or
039:         *  deletion without notice.</b>
040:         */
041:        @Version("@(#)Source.java	1.51 07/05/05")
042:        public enum Source {
043:            /** 1.0 had no inner classes, and so could not pass the JCK. */
044:            // public static final Source JDK1_0 =		new Source("1.0");
045:            /** 1.1 did not have strictfp, and so could not pass the JCK. */
046:            // public static final Source JDK1_1 =		new Source("1.1");
047:            /** 1.2 introduced strictfp. */
048:            JDK1_2("1.2"),
049:
050:            /** 1.3 is the same language as 1.2. */
051:            JDK1_3("1.3"),
052:
053:            /** 1.4 introduced assert. */
054:            JDK1_4("1.4"),
055:
056:            /** 1.5 introduced generics, attributes, foreach, boxing, static import,
057:             *  covariant return, enums, varargs, et al. */
058:            JDK1_5("1.5"),
059:
060:            /** 1.6 reports encoding problems as errors instead of warnings. */
061:            JDK1_6("1.6"),
062:
063:            /** 1.7 covers the to be determined language features that will be added in JDK 7. */
064:            JDK1_7("1.7");
065:
066:            private static final Context.Key<Source> sourceKey = new Context.Key<Source>();
067:
068:            public static Source instance(Context context) {
069:                Source instance = context.get(sourceKey);
070:                if (instance == null) {
071:                    Options options = Options.instance(context);
072:                    String sourceString = options.get("-source");
073:                    if (sourceString != null)
074:                        instance = lookup(sourceString);
075:                    if (instance == null)
076:                        instance = DEFAULT;
077:                    context.put(sourceKey, instance);
078:                }
079:                return instance;
080:            }
081:
082:            public final String name;
083:
084:            private static Map<String, Source> tab = new HashMap<String, Source>();
085:            static {
086:                for (Source s : values()) {
087:                    tab.put(s.name, s);
088:                }
089:                tab.put("5", JDK1_5); // Make 5 an alias for 1.5
090:                tab.put("6", JDK1_6); // Make 6 an alias for 1.6
091:                tab.put("7", JDK1_7); // Make 7 an alias for 1.7
092:            }
093:
094:            private Source(String name) {
095:                this .name = name;
096:            }
097:
098:            public static final Source DEFAULT = JDK1_5;
099:
100:            public static Source lookup(String name) {
101:                return tab.get(name);
102:            }
103:
104:            public Target requiredTarget() {
105:                if (this .compareTo(JDK1_7) >= 0)
106:                    return Target.JDK1_7;
107:                if (this .compareTo(JDK1_6) >= 0)
108:                    return Target.JDK1_6;
109:                if (this .compareTo(JDK1_5) >= 0)
110:                    return Target.JDK1_5;
111:                if (this .compareTo(JDK1_4) >= 0)
112:                    return Target.JDK1_4;
113:                return Target.JDK1_1;
114:            }
115:
116:            /** Allow encoding errors, giving only warnings. */
117:            public boolean allowEncodingErrors() {
118:                return compareTo(JDK1_6) < 0;
119:            }
120:
121:            public boolean allowAsserts() {
122:                return compareTo(JDK1_4) >= 0;
123:            }
124:
125:            public boolean allowCovariantReturns() {
126:                return compareTo(JDK1_5) >= 0;
127:            }
128:
129:            public boolean allowGenerics() {
130:                return compareTo(JDK1_5) >= 0;
131:            }
132:
133:            public boolean allowEnums() {
134:                return compareTo(JDK1_5) >= 0;
135:            }
136:
137:            public boolean allowForeach() {
138:                return compareTo(JDK1_5) >= 0;
139:            }
140:
141:            public boolean allowStaticImport() {
142:                return compareTo(JDK1_5) >= 0;
143:            }
144:
145:            public boolean allowBoxing() {
146:                return compareTo(JDK1_5) >= 0;
147:            }
148:
149:            public boolean allowVarargs() {
150:                return compareTo(JDK1_5) >= 0;
151:            }
152:
153:            public boolean allowAnnotations() {
154:                return compareTo(JDK1_5) >= 0;
155:            }
156:
157:            // hex floating-point literals supported?
158:            public boolean allowHexFloats() {
159:                return compareTo(JDK1_5) >= 0;
160:            }
161:
162:            public boolean allowAnonOuterThis() {
163:                return compareTo(JDK1_5) >= 0;
164:            }
165:
166:            public boolean addBridges() {
167:                return compareTo(JDK1_5) >= 0;
168:            }
169:
170:            public boolean enforceMandatoryWarnings() {
171:                return compareTo(JDK1_5) >= 0;
172:            }
173:
174:            public static SourceVersion toSourceVersion(Source source) {
175:                switch (source) {
176:                case JDK1_2:
177:                    return RELEASE_2;
178:                case JDK1_3:
179:                    return RELEASE_3;
180:                case JDK1_4:
181:                    return RELEASE_4;
182:                case JDK1_5:
183:                    return RELEASE_5;
184:                case JDK1_6:
185:                    return RELEASE_6;
186:                case JDK1_7:
187:                    return RELEASE_7;
188:                default:
189:                    return null;
190:                }
191:            }
192:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.