You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
| 2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
| 2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
| 2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
| 2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
| 2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
|
From: <ls...@us...> - 2007-06-10 19:44:28
|
Revision: 3244
http://jnode.svn.sourceforge.net/jnode/?rev=3244&view=rev
Author: lsantha
Date: 2007-06-10 12:44:27 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
Workaround for javac version resource.
Added Paths:
-----------
trunk/core/src/openjdk/vm/com/
trunk/core/src/openjdk/vm/com/sun/
trunk/core/src/openjdk/vm/com/sun/tools/
trunk/core/src/openjdk/vm/com/sun/tools/javac/
trunk/core/src/openjdk/vm/com/sun/tools/javac/resources/
trunk/core/src/openjdk/vm/com/sun/tools/javac/resources/version.java
Added: trunk/core/src/openjdk/vm/com/sun/tools/javac/resources/version.java
===================================================================
--- trunk/core/src/openjdk/vm/com/sun/tools/javac/resources/version.java (rev 0)
+++ trunk/core/src/openjdk/vm/com/sun/tools/javac/resources/version.java 2007-06-10 19:44:27 UTC (rev 3244)
@@ -0,0 +1,18 @@
+/*
+ * $Id$
+ */
+package com.sun.tools.javac.resources;
+
+import java.util.ListResourceBundle;
+
+public final class version extends ListResourceBundle {
+ private static final Object[][] contents = {
+ { "jdk", "$(JDK_VERSION)" },
+ { "full", "$(FULL_VERSION)" },
+ { "release", "$(RELEASE)" },
+ };
+
+ protected final Object[][] getContents() {
+ return contents;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 19:43:38
|
Revision: 3243
http://jnode.svn.sourceforge.net/jnode/?rev=3243&view=rev
Author: lsantha
Date: 2007-06-10 12:43:37 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
Workaround for javac version resource.
Modified Paths:
--------------
trunk/all/lib/jnode.xml
Modified: trunk/all/lib/jnode.xml
===================================================================
--- trunk/all/lib/jnode.xml 2007-06-10 12:29:59 UTC (rev 3242)
+++ trunk/all/lib/jnode.xml 2007-06-10 19:43:37 UTC (rev 3243)
@@ -14,7 +14,7 @@
target="${java.target}"
source="${java.source}"
encoding="${java.encoding}"
- excludes="**/resources/*.java">
+ excludes="**/resources/*-template.java">
<bootclasspath path="${jnode-core.jar}"/>
<compilerarg value="${compilerarg}"/>
</javac>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 12:30:01
|
Revision: 3242
http://jnode.svn.sourceforge.net/jnode/?rev=3242&view=rev
Author: lsantha
Date: 2007-06-10 05:29:59 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Modified Paths:
--------------
trunk/all/lib/jnode.xml
Modified: trunk/all/lib/jnode.xml
===================================================================
--- trunk/all/lib/jnode.xml 2007-06-10 12:29:26 UTC (rev 3241)
+++ trunk/all/lib/jnode.xml 2007-06-10 12:29:59 UTC (rev 3242)
@@ -13,7 +13,8 @@
includeJavaRuntime="false"
target="${java.target}"
source="${java.source}"
- encoding="${java.encoding}">
+ encoding="${java.encoding}"
+ excludes="**/resources/*.java">
<bootclasspath path="${jnode-core.jar}"/>
<compilerarg value="${compilerarg}"/>
</javac>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 12:29:27
|
Revision: 3241
http://jnode.svn.sourceforge.net/jnode/?rev=3241&view=rev
Author: lsantha
Date: 2007-06-10 05:29:26 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Modified Paths:
--------------
trunk/core/build.xml
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-06-10 12:27:16 UTC (rev 3240)
+++ trunk/core/build.xml 2007-06-10 12:29:26 UTC (rev 3241)
@@ -26,8 +26,10 @@
<pathelement location="${my-src.dir}/classpath/ext"/>
<pathelement location="${my-src.dir}/classpath/vm"/>
<pathelement location="${my-src.dir}/classpath/tools"/>
+ <pathelement location="${my-src.dir}/classpath/sun"/>
<pathelement location="${my-src.dir}/openjdk/java"/>
<pathelement location="${my-src.dir}/openjdk/javax"/>
+ <pathelement location="${my-src.dir}/openjdk/com"/>
<pathelement location="${my-src.dir}/openjdk/sun"/>
<pathelement location="${my-src.dir}/openjdk/vm"/>
</path>
@@ -96,8 +98,10 @@
<fileset dir="${my-src.dir}/classpath/java" includes="**/*.properties"/>
<fileset dir="${my-src.dir}/classpath/vm" includes="**/*.security"/>
<fileset dir="${my-src.dir}/classpath/tools" includes="**/*.jav"/>
+ <fileset dir="${my-src.dir}/classpath/sun" includes="**/*.jav"/>
<fileset dir="${my-src.dir}/openjdk/java" includes="**/*.jav"/>
<fileset dir="${my-src.dir}/openjdk/javax" includes="**/*.jav"/>
+ <fileset dir="${my-src.dir}/openjdk/com" includes="**/*.jav"/>
<fileset dir="${my-src.dir}/openjdk/sun" includes="**/*.jav"/>
<fileset dir="${my-src.dir}/openjdk/vm" includes="**/*.jav"/>
</copy>
@@ -126,8 +130,10 @@
<fileset dir="${my-src.dir}/classpath/ext" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/classpath/vm" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/classpath/tools" excludes="${my-non-resources}"/>
+ <fileset dir="${my-src.dir}/classpath/sun" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/java" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/javax" excludes="${my-non-resources}"/>
+ <fileset dir="${my-src.dir}/openjdk/com" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/sun" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/openjdk/vm" excludes="${my-non-resources}"/>
<fileset dir="${my-src.dir}/core" excludes="${my-non-resources}"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 12:27:18
|
Revision: 3240
http://jnode.svn.sourceforge.net/jnode/?rev=3240&view=rev
Author: lsantha
Date: 2007-06-10 05:27:16 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Added Paths:
-----------
trunk/core/src/openjdk/com/
trunk/core/src/openjdk/com/com/
trunk/core/src/openjdk/com/com/sun/
trunk/core/src/openjdk/com/com/sun/mirror/
trunk/core/src/openjdk/com/com/sun/mirror/apt/
trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessor.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorEnvironment.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorFactory.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorListener.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessors.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/Filer.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/Messager.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundCompleteEvent.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundCompleteListener.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundState.java
trunk/core/src/openjdk/com/com/sun/mirror/apt/package.html
trunk/core/src/openjdk/com/com/sun/mirror/declaration/
trunk/core/src/openjdk/com/com/sun/mirror/declaration/AnnotationMirror.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/AnnotationTypeDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/AnnotationTypeElementDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/AnnotationValue.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/ClassDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/ConstructorDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/Declaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/EnumConstantDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/EnumDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/ExecutableDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/FieldDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/InterfaceDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/MemberDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/MethodDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/Modifier.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/PackageDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/ParameterDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/TypeDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/TypeParameterDeclaration.java
trunk/core/src/openjdk/com/com/sun/mirror/declaration/package.html
trunk/core/src/openjdk/com/com/sun/mirror/overview.html
trunk/core/src/openjdk/com/com/sun/mirror/type/
trunk/core/src/openjdk/com/com/sun/mirror/type/AnnotationType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/ArrayType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/ClassType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/DeclaredType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/EnumType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/InterfaceType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/MirroredTypeException.java
trunk/core/src/openjdk/com/com/sun/mirror/type/MirroredTypesException.java
trunk/core/src/openjdk/com/com/sun/mirror/type/PrimitiveType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/ReferenceType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/TypeMirror.java
trunk/core/src/openjdk/com/com/sun/mirror/type/TypeVariable.java
trunk/core/src/openjdk/com/com/sun/mirror/type/VoidType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/WildcardType.java
trunk/core/src/openjdk/com/com/sun/mirror/type/package.html
trunk/core/src/openjdk/com/com/sun/mirror/util/
trunk/core/src/openjdk/com/com/sun/mirror/util/DeclarationFilter.java
trunk/core/src/openjdk/com/com/sun/mirror/util/DeclarationScanner.java
trunk/core/src/openjdk/com/com/sun/mirror/util/DeclarationVisitor.java
trunk/core/src/openjdk/com/com/sun/mirror/util/DeclarationVisitors.java
trunk/core/src/openjdk/com/com/sun/mirror/util/Declarations.java
trunk/core/src/openjdk/com/com/sun/mirror/util/SimpleDeclarationVisitor.java
trunk/core/src/openjdk/com/com/sun/mirror/util/SimpleTypeVisitor.java
trunk/core/src/openjdk/com/com/sun/mirror/util/SourceOrderDeclScanner.java
trunk/core/src/openjdk/com/com/sun/mirror/util/SourcePosition.java
trunk/core/src/openjdk/com/com/sun/mirror/util/TypeVisitor.java
trunk/core/src/openjdk/com/com/sun/mirror/util/Types.java
trunk/core/src/openjdk/com/com/sun/mirror/util/package.html
trunk/core/src/openjdk/com/com/sun/source/
trunk/core/src/openjdk/com/com/sun/source/tree/
trunk/core/src/openjdk/com/com/sun/source/tree/AnnotationTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ArrayAccessTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ArrayTypeTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/AssertTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/AssignmentTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/BinaryTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/BlockTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/BreakTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/CaseTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/CatchTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ClassTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/CompilationUnitTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/CompoundAssignmentTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ConditionalExpressionTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ContinueTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/DoWhileLoopTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/EmptyStatementTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/EnhancedForLoopTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ErroneousTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ExpressionStatementTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ExpressionTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ForLoopTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/IdentifierTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/IfTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ImportTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/InstanceOfTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/LabeledStatementTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/LineMap.java
trunk/core/src/openjdk/com/com/sun/source/tree/LiteralTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/MemberSelectTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/MethodInvocationTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/MethodTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ModifiersTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/NewArrayTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/NewClassTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ParameterizedTypeTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ParenthesizedTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/PrimitiveTypeTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ReturnTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/Scope.java
trunk/core/src/openjdk/com/com/sun/source/tree/StatementTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/SwitchTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/SynchronizedTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/ThrowTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/Tree.java
trunk/core/src/openjdk/com/com/sun/source/tree/TreeVisitor.java
trunk/core/src/openjdk/com/com/sun/source/tree/TryTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/TypeCastTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/TypeParameterTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/UnaryTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/VariableTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/WhileLoopTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/WildcardTree.java
trunk/core/src/openjdk/com/com/sun/source/tree/package-info.java
trunk/core/src/openjdk/com/com/sun/source/util/
trunk/core/src/openjdk/com/com/sun/source/util/JavacTask.java
trunk/core/src/openjdk/com/com/sun/source/util/SimpleTreeVisitor.java
trunk/core/src/openjdk/com/com/sun/source/util/SourcePositions.java
trunk/core/src/openjdk/com/com/sun/source/util/TaskEvent.java
trunk/core/src/openjdk/com/com/sun/source/util/TaskListener.java
trunk/core/src/openjdk/com/com/sun/source/util/TreePath.java
trunk/core/src/openjdk/com/com/sun/source/util/TreePathScanner.java
trunk/core/src/openjdk/com/com/sun/source/util/TreeScanner.java
trunk/core/src/openjdk/com/com/sun/source/util/Trees.java
trunk/core/src/openjdk/com/com/sun/source/util/package-info.java
trunk/core/src/openjdk/com/com/sun/tools/
trunk/core/src/openjdk/com/com/sun/tools/apt/
trunk/core/src/openjdk/com/com/sun/tools/apt/Main.java
trunk/core/src/openjdk/com/com/sun/tools/apt/comp/
trunk/core/src/openjdk/com/com/sun/tools/apt/comp/AnnotationProcessingError.java
trunk/core/src/openjdk/com/com/sun/tools/apt/comp/Apt.java
trunk/core/src/openjdk/com/com/sun/tools/apt/comp/BootstrapAPF.java
trunk/core/src/openjdk/com/com/sun/tools/apt/comp/PrintAP.java
trunk/core/src/openjdk/com/com/sun/tools/apt/comp/UsageMessageNeededException.java
trunk/core/src/openjdk/com/com/sun/tools/apt/main/
trunk/core/src/openjdk/com/com/sun/tools/apt/main/CommandLine.java
trunk/core/src/openjdk/com/com/sun/tools/apt/main/JavaCompiler.java
trunk/core/src/openjdk/com/com/sun/tools/apt/main/Main.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/AptEnv.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/apt/
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/apt/AnnotationProcessorEnvironmentImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/apt/FilerImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/apt/MessagerImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/apt/RoundCompleteEventImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/apt/RoundStateImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/AnnotationMirrorImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/AnnotationTypeDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/AnnotationTypeElementDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/AnnotationValueImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/ClassDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/Constants.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/ConstructorDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/DeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/DeclarationMaker.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/EnumConstantDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/EnumDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/ExecutableDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/FieldDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/InterfaceDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/MemberDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/MethodDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/PackageDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/ParameterDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/TypeDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/declaration/TypeParameterDeclarationImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/AnnotationTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/ArrayTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/ClassTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/DeclaredTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/EnumTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/InterfaceTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/PrimitiveTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/TypeMaker.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/TypeMirrorImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/TypeVariableImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/VoidTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/type/WildcardTypeImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/util/
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/util/DeclarationsImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/util/SourcePositionImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/mirror/util/TypesImpl.java
trunk/core/src/openjdk/com/com/sun/tools/apt/resources/
trunk/core/src/openjdk/com/com/sun/tools/apt/resources/apt.properties
trunk/core/src/openjdk/com/com/sun/tools/apt/resources/apt_ja.properties
trunk/core/src/openjdk/com/com/sun/tools/apt/resources/apt_zh_CN.properties
trunk/core/src/openjdk/com/com/sun/tools/apt/util/
trunk/core/src/openjdk/com/com/sun/tools/apt/util/Bark.java
trunk/core/src/openjdk/com/com/sun/tools/javac/
trunk/core/src/openjdk/com/com/sun/tools/javac/Launcher.java
trunk/core/src/openjdk/com/com/sun/tools/javac/Main.java
trunk/core/src/openjdk/com/com/sun/tools/javac/Server.java
trunk/core/src/openjdk/com/com/sun/tools/javac/api/
trunk/core/src/openjdk/com/com/sun/tools/javac/api/JavacScope.java
trunk/core/src/openjdk/com/com/sun/tools/javac/api/JavacTaskImpl.java
trunk/core/src/openjdk/com/com/sun/tools/javac/api/JavacTool.java
trunk/core/src/openjdk/com/com/sun/tools/javac/api/JavacTrees.java
trunk/core/src/openjdk/com/com/sun/tools/javac/api/WrappingJavaFileManager.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Attribute.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/BoundKind.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Flags.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Kinds.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Lint.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Scope.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Source.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Symbol.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Symtab.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Type.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/TypeTags.java
trunk/core/src/openjdk/com/com/sun/tools/javac/code/Types.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Annotate.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Attr.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/AttrContext.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/AttrContextEnv.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Check.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/ConstFold.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Enter.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Env.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Flow.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Infer.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Lower.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/MemberEnter.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Resolve.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/Todo.java
trunk/core/src/openjdk/com/com/sun/tools/javac/comp/TransTypes.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/ByteCodes.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/CRTFlags.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/CRTable.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/ClassFile.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/ClassReader.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/ClassWriter.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/Code.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/Gen.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/Items.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/Pool.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/Target.java
trunk/core/src/openjdk/com/com/sun/tools/javac/jvm/UninitializedType.java
trunk/core/src/openjdk/com/com/sun/tools/javac/main/
trunk/core/src/openjdk/com/com/sun/tools/javac/main/CommandLine.java
trunk/core/src/openjdk/com/com/sun/tools/javac/main/JavaCompiler.java
trunk/core/src/openjdk/com/com/sun/tools/javac/main/JavacOption.java
trunk/core/src/openjdk/com/com/sun/tools/javac/main/Main.java
trunk/core/src/openjdk/com/com/sun/tools/javac/main/OptionName.java
trunk/core/src/openjdk/com/com/sun/tools/javac/main/RecognizedOptions.java
trunk/core/src/openjdk/com/com/sun/tools/javac/model/
trunk/core/src/openjdk/com/com/sun/tools/javac/model/AnnotationProxyMaker.java
trunk/core/src/openjdk/com/com/sun/tools/javac/model/FilteredMemberList.java
trunk/core/src/openjdk/com/com/sun/tools/javac/model/JavacElements.java
trunk/core/src/openjdk/com/com/sun/tools/javac/model/JavacSourcePosition.java
trunk/core/src/openjdk/com/com/sun/tools/javac/model/JavacTypes.java
trunk/core/src/openjdk/com/com/sun/tools/javac/parser/
trunk/core/src/openjdk/com/com/sun/tools/javac/parser/DocCommentScanner.java
trunk/core/src/openjdk/com/com/sun/tools/javac/parser/EndPosParser.java
trunk/core/src/openjdk/com/com/sun/tools/javac/parser/Keywords.java
trunk/core/src/openjdk/com/com/sun/tools/javac/parser/Lexer.java
trunk/core/src/openjdk/com/com/sun/tools/javac/parser/Parser.java
trunk/core/src/openjdk/com/com/sun/tools/javac/parser/Scanner.java
trunk/core/src/openjdk/com/com/sun/tools/javac/parser/Token.java
trunk/core/src/openjdk/com/com/sun/tools/javac/processing/
trunk/core/src/openjdk/com/com/sun/tools/javac/processing/AnnotationProcessingError.java
trunk/core/src/openjdk/com/com/sun/tools/javac/processing/JavacFiler.java
trunk/core/src/openjdk/com/com/sun/tools/javac/processing/JavacMessager.java
trunk/core/src/openjdk/com/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
trunk/core/src/openjdk/com/com/sun/tools/javac/processing/JavacRoundEnvironment.java
trunk/core/src/openjdk/com/com/sun/tools/javac/processing/PrintingProcessor.java
trunk/core/src/openjdk/com/com/sun/tools/javac/processing/ServiceProxy.java
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/compiler.properties
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/compiler_ja.properties
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/compiler_zh_CN.properties
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/javac.properties
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/javac_ja.properties
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/javac_zh_CN.properties
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/legacy.properties
trunk/core/src/openjdk/com/com/sun/tools/javac/resources/version-template.java
trunk/core/src/openjdk/com/com/sun/tools/javac/services/
trunk/core/src/openjdk/com/com/sun/tools/javac/services/javax.tools.JavaCompilerTool
trunk/core/src/openjdk/com/com/sun/tools/javac/sym/
trunk/core/src/openjdk/com/com/sun/tools/javac/sym/CreateSymbols.java
trunk/core/src/openjdk/com/com/sun/tools/javac/tree/
trunk/core/src/openjdk/com/com/sun/tools/javac/tree/JCTree.java
trunk/core/src/openjdk/com/com/sun/tools/javac/tree/Pretty.java
trunk/core/src/openjdk/com/com/sun/tools/javac/tree/TreeCopier.java
trunk/core/src/openjdk/com/com/sun/tools/javac/tree/TreeInfo.java
trunk/core/src/openjdk/com/com/sun/tools/javac/tree/TreeMaker.java
trunk/core/src/openjdk/com/com/sun/tools/javac/tree/TreeScanner.java
trunk/core/src/openjdk/com/com/sun/tools/javac/tree/TreeTranslator.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Abort.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/BaseFileObject.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Bits.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/ByteBuffer.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/ClientCodeException.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Constants.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Context.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Convert.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/DiagnosticFormatter.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/FatalError.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/JCDiagnostic.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/JavacFileManager.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/LayoutCharacters.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/List.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/ListBuffer.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Log.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/MandatoryWarningHandler.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Messages.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Name.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Old199.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Options.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Pair.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Paths.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Position.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/PropagatedException.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Version.java
trunk/core/src/openjdk/com/com/sun/tools/javac/util/Warner.java
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessor.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessor.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessor.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+
+import java.io.IOException;
+import java.util.Collection;
+
+
+/**
+ * An annotation processor, used to examine and process the
+ * annotations of program elements. An annotation processor may,
+ * for example, create new source files and XML documents to be used
+ * in conjunction with the original code.
+ *
+ * <p> An annotation processor is constructed by a
+ * {@linkplain AnnotationProcessorFactory factory}, which provides it with an
+ * {@linkplain AnnotationProcessorEnvironment environment} that
+ * encapsulates the state it needs.
+ * Messages regarding warnings and errors encountered during processing
+ * should be directed to the environment's {@link Messager},
+ * and new files may be created using the environment's {@link Filer}.
+ *
+ * <p> Each annotation processor is created to process annotations
+ * of a particular annotation type or set of annotation types.
+ * It may use its environment to find the program elements with
+ * annotations of those types. It may freely examine any other program
+ * elements in the course of its processing.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @version 1.9 07/05/05
+ * @since 1.5
+ */
+
+public interface AnnotationProcessor {
+
+ /**
+ * Process all program elements supported by this annotation processor.
+ */
+ void process();
+}
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorEnvironment.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorEnvironment.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorEnvironment.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+
+import java.util.Collection;
+import java.util.Map;
+
+import com.sun.mirror.declaration.*;
+import com.sun.mirror.util.*;
+
+
+/**
+ * The environment encapsulating the state needed by an annotation processor.
+ * An annotation processing tool makes this environment available
+ * to all annotation processors.
+ *
+ * <p> When an annotation processing tool is invoked, it is given a
+ * set of type declarations on which to operate. These
+ * are refered to as the <i>specified</i> types.
+ * The type declarations said to be <i>included</i> in this invocation
+ * consist of the specified types and any types nested within them.
+ *
+ * <p> {@link DeclarationFilter}
+ * provides a simple way to select just the items of interest
+ * when a method returns a collection of declarations.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @version 1.14 07/05/05
+ * @since 1.5
+ */
+
+public interface AnnotationProcessorEnvironment {
+
+ /**
+ * Returns the options passed to the annotation processing tool.
+ * Options are returned in the form of a map from option name
+ * (such as <tt>"-encoding"</tt>) to option value.
+ * For an option with no value (such as <tt>"-help"</tt>), the
+ * corresponding value in the map is <tt>null</tt>.
+ *
+ * <p> Options beginning with <tt>"-A"</tt> are <i>processor-specific.</i>
+ * Such options are unrecognized by the tool, but intended to be used by
+ * some annotation processor.
+ *
+ * @return the options passed to the tool
+ */
+ Map<String,String> getOptions();
+
+ /**
+ * Returns the messager used to report errors, warnings, and other
+ * notices.
+ *
+ * @return the messager
+ */
+ Messager getMessager();
+
+ /**
+ * Returns the filer used to create new source, class, or auxiliary
+ * files.
+ *
+ * @return the filer
+ */
+ Filer getFiler();
+
+
+
+ /**
+ * Returns the declarations of the types specified when the
+ * annotation processing tool was invoked.
+ *
+ * @return the types specified when the tool was invoked, or an
+ * empty collection if there were none
+ */
+ Collection<TypeDeclaration> getSpecifiedTypeDeclarations();
+
+ /**
+ * Returns the declaration of a package given its fully qualified name.
+ *
+ * @param name fully qualified package name, or "" for the unnamed package
+ * @return the declaration of the named package, or null if it cannot
+ * be found
+ */
+ PackageDeclaration getPackage(String name);
+
+ /**
+ * Returns the declaration of a type given its fully qualified name.
+ *
+ * @param name fully qualified type name
+ * @return the declaration of the named type, or null if it cannot be
+ * found
+ */
+ TypeDeclaration getTypeDeclaration(String name);
+
+ /**
+ * A convenience method that returns the declarations of the types
+ * {@linkplain AnnotationProcessorEnvironment <i>included</i>}
+ * in this invocation of the annotation processing tool.
+ *
+ * @return the declarations of the types included in this invocation
+ * of the tool, or an empty collection if there are none
+ */
+ Collection<TypeDeclaration> getTypeDeclarations();
+
+ /**
+ * Returns the declarations annotated with the given annotation type.
+ * Only declarations of the types
+ * {@linkplain AnnotationProcessorEnvironment <i>included</i>}
+ * in this invocation of the annotation processing tool, or
+ * declarations of members, parameters, or type parameters
+ * declared within those, are returned.
+ *
+ * @param a annotation type being requested
+ * @return the declarations annotated with the given annotation type,
+ * or an empty collection if there are none
+ */
+ Collection<Declaration> getDeclarationsAnnotatedWith(
+ AnnotationTypeDeclaration a);
+
+ /**
+ * Returns an implementation of some utility methods for
+ * operating on declarations.
+ *
+ * @return declaration utilities
+ */
+ Declarations getDeclarationUtils();
+
+ /**
+ * Returns an implementation of some utility methods for
+ * operating on types.
+ *
+ * @return type utilities
+ */
+ Types getTypeUtils();
+
+ /**
+ * Add a listener. If the listener is currently registered to listen,
+ * adding it again will have no effect.
+ *
+ * @param listener The listener to add.
+ * @throws NullPointerException if the listener is null
+ */
+ void addListener(AnnotationProcessorListener listener);
+
+
+ /**
+ * Remove a listener. If the listener is not currently listening,
+ * the method call does nothing.
+ *
+ * @param listener The listener to remove.
+ * @throws NullPointerException if the listener is null
+ */
+ void removeListener(AnnotationProcessorListener listener);
+}
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorFactory.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorFactory.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorFactory.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+
+import java.util.Collection;
+import java.util.Set;
+
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+
+
+/**
+ * A factory for creating annotation processors.
+ * Each factory is responsible for creating processors for one or more
+ * annotation types.
+ * The factory is said to <i>support</i> these types.
+ *
+ * <p> Each implementation of an <tt>AnnotationProcessorFactory</tt>
+ * must provide a public no-argument constructor to be used by tools to
+ * instantiate the factory.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @version 1.16 07/05/05
+ * @since 1.5
+ */
+
+public interface AnnotationProcessorFactory {
+
+ /**
+ * Returns the options recognized by this factory or by any of the
+ * processors it may create.
+ * Only {@linkplain AnnotationProcessorEnvironment#getOptions()
+ * processor-specific} options are included, each of which begins
+ * with <tt>"-A"</tt>. For example, if this factory recognizes
+ * options such as <tt>-Adebug -Aloglevel=3</tt>, it will
+ * return the strings <tt>"-Adebug"</tt> and <tt>"-Aloglevel"</tt>.
+ *
+ * <p> A tool might use this information to determine if any
+ * options provided by a user are unrecognized by any processor,
+ * in which case it may wish to report an error.
+ *
+ * @return the options recognized by this factory or by any of the
+ * processors it may create, or an empty collection if none
+ */
+ Collection<String> supportedOptions();
+
+ /**
+ * Returns the names of the annotation types supported by this factory.
+ * An element of the result may be the canonical (fully qualified) name
+ * of a supported annotation type. Alternately it may be of the form
+ * <tt>"<i>name</i>.*"</tt>
+ * representing the set of all annotation types
+ * with canonical names beginning with <tt>"<i>name</i>."</tt>
+ * Finally, <tt>"*"</tt> by itself represents the set of all
+ * annotation types.
+ *
+ * @return the names of the annotation types supported by this factory
+ */
+ Collection<String> supportedAnnotationTypes();
+
+ /**
+ * Returns an annotation processor for a set of annotation
+ * types. The set will be empty if the factory supports
+ * "<tt>*</tt>" and the specified type declarations have
+ * no annotations. Note that the set of annotation types may be
+ * empty for other reasons, such as giving the factory an
+ * opportunity to register a listener. An
+ * <tt>AnnotationProcessorFactory</tt> must gracefully handle an
+ * empty set of annotations; an appropriate response to an empty
+ * set will often be returning {@link AnnotationProcessors#NO_OP}.
+ *
+ * @param atds type declarations of the annotation types to be processed
+ * @param env environment to use during processing
+ * @return an annotation processor for the given annotation types,
+ * or <tt>null</tt> if the types are not supported or the
+ * processor cannot be created
+ */
+ AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
+ AnnotationProcessorEnvironment env);
+}
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorListener.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorListener.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessorListener.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+/**
+ * Superinterface for all annotation processor event listeners.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @version 1.8 07/05/05
+ * @since 1.5
+ */
+public interface AnnotationProcessorListener extends java.util.EventListener {}
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessors.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessors.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/AnnotationProcessors.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+import com.sun.mirror.apt.*;
+import java.util.*;
+
+/**
+ * Utilities to create specialized annotation processors.
+ *
+ * @since 1.5
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ */
+public class AnnotationProcessors {
+ static class NoOpAP implements AnnotationProcessor {
+ NoOpAP() {}
+ public void process(){}
+ }
+
+ /**
+ * Combines multiple annotation processors into a simple composite
+ * processor.
+ * The composite processor functions by invoking each of its component
+ * processors in sequence.
+ */
+ static class CompositeAnnotationProcessor implements AnnotationProcessor {
+
+ private List<AnnotationProcessor> aps =
+ new LinkedList<AnnotationProcessor>();
+
+ /**
+ * Constructs a new composite annotation processor.
+ * @param aps the component annotation processors
+ */
+ public CompositeAnnotationProcessor(Collection<AnnotationProcessor> aps) {
+ this.aps.addAll(aps);
+ }
+
+ /**
+ * Constructs a new composite annotation processor.
+ * @param aps the component annotation processors
+ */
+ public CompositeAnnotationProcessor(AnnotationProcessor... aps) {
+ for(AnnotationProcessor ap: aps)
+ this.aps.add(ap);
+ }
+
+ /**
+ * Invokes the <tt>process</tt> method of each component processor,
+ * in the order in which the processors were passed to the constructor.
+ */
+ public void process() {
+ for(AnnotationProcessor ap: aps)
+ ap.process();
+ }
+ }
+
+
+ /**
+ * An annotation processor that does nothing and has no state.
+ * May be used multiple times.
+ *
+ * @since 1.5
+ */
+ public final static AnnotationProcessor NO_OP = new NoOpAP();
+
+ /**
+ * Constructs a new composite annotation processor. A composite
+ * annotation processor combines multiple annotation processors
+ * into one and functions by invoking each of its component
+ * processors' process methods in sequence.
+ *
+ * @param aps The processors to create a composite of
+ * @since 1.5
+ */
+ public static AnnotationProcessor getCompositeAnnotationProcessor(AnnotationProcessor... aps) {
+ return new CompositeAnnotationProcessor(aps);
+ }
+
+ /**
+ * Constructs a new composite annotation processor. A composite
+ * annotation processor combines multiple annotation processors
+ * into one and functions by invoking each of its component
+ * processors' process methods in the sequence the processors are
+ * returned by the collection's iterator.
+ *
+ * @param aps A collection of processors to create a composite of
+ * @since 1.5
+ */
+ public static AnnotationProcessor getCompositeAnnotationProcessor(Collection<AnnotationProcessor> aps) {
+ return new CompositeAnnotationProcessor(aps);
+ }
+}
+
+
+
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/Filer.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/Filer.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/Filer.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+
+import java.io.*;
+
+
+/**
+ * This interface supports the creation of new files by an
+ * annotation processor.
+ * Files created in this way will be known to the annotation processing
+ * tool implementing this interface, better enabling the tool to manage them.
+ * Four kinds of files are distinguished:
+ * source files, class files, other text files, and other binary files.
+ * The latter two are collectively referred to as <i>auxiliary</i> files.
+ *
+ * <p> There are two distinguished locations (subtrees within the
+ * file system) where newly created files are placed:
+ * one for new source files, and one for new class files.
+ * (These might be specified on a tool's command line, for example,
+ * using flags such as <tt>-s</tt> and <tt>-d</tt>.)
+ * Auxiliary files may be created in either location.
+ *
+ * <p> During each run of an annotation processing tool, a file
+ * with a given pathname may be created only once. If that file already
+ * exists before the first attempt to create it, the old contents will
+ * be deleted. Any subsequent attempt to create the same file during
+ * a run will fail.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @version 1.8 07/05/05
+ * @since 1.5
+ */
+
+public interface Filer {
+
+ /**
+ * Creates a new source file and returns a writer for it.
+ * The file's name and path (relative to the root of all newly created
+ * source files) is based on the type to be declared in that file.
+ * If more than one type is being declared, the name of the principal
+ * top-level type (the public one, for example) should be used.
+ *
+ * <p> The {@linkplain java.nio.charset.Charset charset} used to
+ * encode the file is determined by the implementation.
+ * An annotation processing tool may have an <tt>-encoding</tt>
+ * flag or the like for specifying this. It will typically use
+ * the platform's default encoding if none is specified.
+ *
+ * @param name canonical (fully qualified) name of the principal type
+ * being declared in this file
+ * @return a writer for the new file
+ * @throws IOException if the file cannot be created
+ */
+ PrintWriter createSourceFile(String name) throws IOException;
+
+ /**
+ * Creates a new class file, and returns a stream for writing to it.
+ * The file's name and path (relative to the root of all newly created
+ * class files) is based on the name of the type being written.
+ *
+ * @param name canonical (fully qualified) name of the type being written
+ * @return a stream for writing to the new file
+ * @throws IOException if the file cannot be created
+ */
+ OutputStream createClassFile(String name) throws IOException;
+
+ /**
+ * Creates a new text file, and returns a writer for it.
+ * The file is located along with either the
+ * newly created source or newly created binary files. It may be
+ * named relative to some package (as are source and binary files),
+ * and from there by an arbitrary pathname. In a loose sense, the
+ * pathname of the new file will be the concatenation of
+ * <tt>loc</tt>, <tt>pkg</tt>, and <tt>relPath</tt>.
+ *
+ * <p> A {@linkplain java.nio.charset.Charset charset} for
+ * encoding the file may be provided. If none is given, the
+ * charset used to encode source files
+ * (see {@link #createSourceFile(String)}) will be used.
+ *
+ * @param loc location of the new file
+ * @param pkg package relative to which the file should be named,
+ * or the empty string if none
+ * @param relPath final pathname components of the file
+ * @param charsetName the name of the charset to use, or null if none
+ * is being explicitly specified
+ * @return a writer for the new file
+ * @throws IOException if the file cannot be created
+ */
+ PrintWriter createTextFile(Location loc,
+ String pkg,
+ File relPath,
+ String charsetName) throws IOException;
+
+ /**
+ * Creates a new binary file, and returns a stream for writing to it.
+ * The file is located along with either the
+ * newly created source or newly created binary files. It may be
+ * named relative to some package (as are source and binary files),
+ * and from there by an arbitrary pathname. In a loose sense, the
+ * pathname of the new file will be the concatenation of
+ * <tt>loc</tt>, <tt>pkg</tt>, and <tt>relPath</tt>.
+ *
+ * @param loc location of the new file
+ * @param pkg package relative to which the file should be named,
+ * or the empty string if none
+ * @param relPath final pathname components of the file
+ * @return a stream for writing to the new file
+ * @throws IOException if the file cannot be created
+ */
+ OutputStream createBinaryFile(Location loc,
+ String pkg,
+ File relPath) throws IOException;
+
+
+ /**
+ * Locations (subtrees within the file system) where new files are created.
+ */
+ enum Location {
+ /** The location of new source files. */
+ SOURCE_TREE,
+ /** The location of new class files. */
+ CLASS_TREE
+ }
+}
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/Messager.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/Messager.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/Messager.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+
+import com.sun.mirror.util.SourcePosition;
+
+
+/**
+ * A <tt>Messager</tt> provides the way for
+ * an annotation processor to report error messages, warnings, and
+ * other notices.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @version 1.9 07/05/05
+ * @since 1.5
+ */
+
+public interface Messager {
+
+ /**
+ * Prints an error message.
+ * Equivalent to <tt>printError(null, msg)</tt>.
+ * @param msg the message, or an empty string if none
+ */
+ void printError(String msg);
+
+ /**
+ * Prints an error message.
+ * @param pos the position where the error occured, or null if it is
+ * unknown or not applicable
+ * @param msg the message, or an empty string if none
+ */
+ void printError(SourcePosition pos, String msg);
+
+ /**
+ * Prints a warning message.
+ * Equivalent to <tt>printWarning(null, msg)</tt>.
+ * @param msg the message, or an empty string if none
+ */
+ void printWarning(String msg);
+
+ /**
+ * Prints a warning message.
+ * @param pos the position where the warning occured, or null if it is
+ * unknown or not applicable
+ * @param msg the message, or an empty string if none
+ */
+ void printWarning(SourcePosition pos, String msg);
+
+ /**
+ * Prints a notice.
+ * Equivalent to <tt>printNotice(null, msg)</tt>.
+ * @param msg the message, or an empty string if none
+ */
+ void printNotice(String msg);
+
+ /**
+ * Prints a notice.
+ * @param pos the position where the noticed occured, or null if it is
+ * unknown or not applicable
+ * @param msg the message, or an empty string if none
+ */
+ void printNotice(SourcePosition pos, String msg);
+}
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundCompleteEvent.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundCompleteEvent.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundCompleteEvent.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+/**
+ * Event for the completion of a round of annotation processing.
+ *
+ * <p>While this class extends the serializable <tt>EventObject</tt>, it
+ * cannot meaningfully be serialized because all of the annotation
+ * processing tool's internal state would potentially be needed.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @version 1.9 07/05/05
+ * @since 1.5
+ */
+public abstract class RoundCompleteEvent extends java.util.EventObject {
+ private RoundState rs;
+
+ /**
+ * The current <tt>AnnotationProcessorEnvironment</tt> is regarded
+ * as the source of events.
+ *
+ * @param source The source of events
+ * @param rs The state of the round
+ */
+ protected RoundCompleteEvent(AnnotationProcessorEnvironment source,
+ RoundState rs) {
+ super(source);
+ this.rs = rs;
+ }
+
+ /**
+ * Return round state.
+ */
+ public RoundState getRoundState() {
+ return rs;
+ }
+
+ /**
+ * Return source.
+ */
+ public AnnotationProcessorEnvironment getSource() {
+ return (AnnotationProcessorEnvironment)super.getSource();
+ }
+}
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundCompleteListener.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundCompleteListener.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundCompleteListener.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package com.sun.mirror.apt;
+
+/**
+ * Listener for the completion of a round of annotation processing.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @version 1.8 07/05/05
+ * @since 1.5
+ */
+public interface RoundCompleteListener extends AnnotationProcessorListener {
+ /**
+ * Invoked after all processors for a round have run to completion.
+ *
+ * @param event An event for round completion
+ */
+ void roundComplete(RoundCompleteEvent event);
+}
Added: trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundState.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundState.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/mirror/apt/RoundState.java 2007-06-10 12:27:16 UTC (rev 3240)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License ver...
[truncated message content] |
|
From: <ls...@us...> - 2007-06-10 12:22:24
|
Revision: 3239
http://jnode.svn.sourceforge.net/jnode/?rev=3239&view=rev
Author: lsantha
Date: 2007-06-10 05:22:23 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/annotation/
trunk/core/src/openjdk/javax/javax/annotation/Generated.java
trunk/core/src/openjdk/javax/javax/annotation/PostConstruct.java
trunk/core/src/openjdk/javax/javax/annotation/PreDestroy.java
trunk/core/src/openjdk/javax/javax/annotation/Resource.java
trunk/core/src/openjdk/javax/javax/annotation/Resources.java
trunk/core/src/openjdk/javax/javax/annotation/processing/
trunk/core/src/openjdk/javax/javax/annotation/processing/AbstractProcessor.java
trunk/core/src/openjdk/javax/javax/annotation/processing/Completion.java
trunk/core/src/openjdk/javax/javax/annotation/processing/Completions.java
trunk/core/src/openjdk/javax/javax/annotation/processing/Filer.java
trunk/core/src/openjdk/javax/javax/annotation/processing/FilerException.java
trunk/core/src/openjdk/javax/javax/annotation/processing/Messager.java
trunk/core/src/openjdk/javax/javax/annotation/processing/ProcessingEnvironment.java
trunk/core/src/openjdk/javax/javax/annotation/processing/Processor.java
trunk/core/src/openjdk/javax/javax/annotation/processing/RoundEnvironment.java
trunk/core/src/openjdk/javax/javax/annotation/processing/SupportedAnnotationTypes.java
trunk/core/src/openjdk/javax/javax/annotation/processing/SupportedOptions.java
trunk/core/src/openjdk/javax/javax/annotation/processing/SupportedSourceVersion.java
trunk/core/src/openjdk/javax/javax/annotation/processing/package-info.java
trunk/core/src/openjdk/javax/javax/lang/
trunk/core/src/openjdk/javax/javax/lang/model/
trunk/core/src/openjdk/javax/javax/lang/model/SourceVersion.java
trunk/core/src/openjdk/javax/javax/lang/model/element/
trunk/core/src/openjdk/javax/javax/lang/model/element/AnnotationMirror.java
trunk/core/src/openjdk/javax/javax/lang/model/element/AnnotationValue.java
trunk/core/src/openjdk/javax/javax/lang/model/element/AnnotationValueVisitor.java
trunk/core/src/openjdk/javax/javax/lang/model/element/Element.java
trunk/core/src/openjdk/javax/javax/lang/model/element/ElementKind.java
trunk/core/src/openjdk/javax/javax/lang/model/element/ElementVisitor.java
trunk/core/src/openjdk/javax/javax/lang/model/element/ExecutableElement.java
trunk/core/src/openjdk/javax/javax/lang/model/element/Modifier.java
trunk/core/src/openjdk/javax/javax/lang/model/element/Name.java
trunk/core/src/openjdk/javax/javax/lang/model/element/NestingKind.java
trunk/core/src/openjdk/javax/javax/lang/model/element/PackageElement.java
trunk/core/src/openjdk/javax/javax/lang/model/element/TypeElement.java
trunk/core/src/openjdk/javax/javax/lang/model/element/TypeParameterElement.java
trunk/core/src/openjdk/javax/javax/lang/model/element/UnknownAnnotationValueException.java
trunk/core/src/openjdk/javax/javax/lang/model/element/UnknownElementException.java
trunk/core/src/openjdk/javax/javax/lang/model/element/VariableElement.java
trunk/core/src/openjdk/javax/javax/lang/model/element/package-info.java
trunk/core/src/openjdk/javax/javax/lang/model/overview.html
trunk/core/src/openjdk/javax/javax/lang/model/package-info.java
trunk/core/src/openjdk/javax/javax/lang/model/type/
trunk/core/src/openjdk/javax/javax/lang/model/type/ArrayType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/DeclaredType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/ErrorType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/ExecutableType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/MirroredTypeException.java
trunk/core/src/openjdk/javax/javax/lang/model/type/MirroredTypesException.java
trunk/core/src/openjdk/javax/javax/lang/model/type/NoType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/NullType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/PrimitiveType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/ReferenceType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/TypeKind.java
trunk/core/src/openjdk/javax/javax/lang/model/type/TypeMirror.java
trunk/core/src/openjdk/javax/javax/lang/model/type/TypeVariable.java
trunk/core/src/openjdk/javax/javax/lang/model/type/TypeVisitor.java
trunk/core/src/openjdk/javax/javax/lang/model/type/UnknownTypeException.java
trunk/core/src/openjdk/javax/javax/lang/model/type/WildcardType.java
trunk/core/src/openjdk/javax/javax/lang/model/type/package-info.java
trunk/core/src/openjdk/javax/javax/lang/model/util/
trunk/core/src/openjdk/javax/javax/lang/model/util/AbstractAnnotationValueVisitor6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/AbstractElementVisitor6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/AbstractTypeVisitor6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/ElementFilter.java
trunk/core/src/openjdk/javax/javax/lang/model/util/ElementKindVisitor6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/ElementScanner6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/Elements.java
trunk/core/src/openjdk/javax/javax/lang/model/util/SimpleAnnotationValueVisitor6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/SimpleElementVisitor6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/SimpleTypeVisitor6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/TypeKindVisitor6.java
trunk/core/src/openjdk/javax/javax/lang/model/util/Types.java
trunk/core/src/openjdk/javax/javax/lang/model/util/package-info.java
trunk/core/src/openjdk/javax/javax/tools/
trunk/core/src/openjdk/javax/javax/tools/Diagnostic.java
trunk/core/src/openjdk/javax/javax/tools/DiagnosticCollector.java
trunk/core/src/openjdk/javax/javax/tools/DiagnosticListener.java
trunk/core/src/openjdk/javax/javax/tools/FileObject.java
trunk/core/src/openjdk/javax/javax/tools/ForwardingFileObject.java
trunk/core/src/openjdk/javax/javax/tools/ForwardingJavaFileManager.java
trunk/core/src/openjdk/javax/javax/tools/ForwardingJavaFileObject.java
trunk/core/src/openjdk/javax/javax/tools/JavaCompiler.java
trunk/core/src/openjdk/javax/javax/tools/JavaFileManager.java
trunk/core/src/openjdk/javax/javax/tools/JavaFileObject.java
trunk/core/src/openjdk/javax/javax/tools/OptionChecker.java
trunk/core/src/openjdk/javax/javax/tools/SimpleJavaFileObject.java
trunk/core/src/openjdk/javax/javax/tools/StandardJavaFileManager.java
trunk/core/src/openjdk/javax/javax/tools/StandardLocation.java
trunk/core/src/openjdk/javax/javax/tools/Tool.java
trunk/core/src/openjdk/javax/javax/tools/ToolProvider.java
trunk/core/src/openjdk/javax/javax/tools/overview.html
trunk/core/src/openjdk/javax/javax/tools/package-info.java
Added: trunk/core/src/openjdk/javax/javax/annotation/Generated.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/Generated.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/Generated.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+//Copyright Sun Microsystems Inc. 2004 - 2005.
+
+package javax.annotation;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * The Generated annoation is used to mark source code that has been generated.
+ * It can also be used to differentiate user written code from generated code
+ * in a single file. When used, the value element must have the name of the
+ * code generator. The recommended convention is to use the fully qualified
+ * name of the code generator in the value field .
+ * For example: com.company.package.classname.
+ * The date element is used to indicate the date the source was generated.
+ * The date element must follow the ISO 8601 standard. For example the date
+ * element would have the following value 2001-07-04T12:08:56.235-0700
+ * which represents 2001-07-04 12:08:56 local time in the U.S. Pacific
+ * Time time zone.
+ * The comment element is a place holder for any comments that the code
+ * generator may want to include in the generated code.
+ *
+ * @since Common Annotations 1.0
+ */
+
+@Documented
+@Retention(SOURCE)
+@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD,
+ LOCAL_VARIABLE, PARAMETER})
+public @interface Generated {
+ /**
+ * This is used by the code generator to mark the generated classes
+ * and methods.
+ */
+ String[] value();
+
+ /**
+ * Date when the source was generated.
+ */
+ String date() default "";
+
+ /**
+ * A place holder for any comments that the code generator may want to
+ * include in the generated code.
+ */
+ String comments() default "";
+}
+
Added: trunk/core/src/openjdk/javax/javax/annotation/PostConstruct.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/PostConstruct.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/PostConstruct.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+//Copyright Sun Microsystems Inc. 2004 - 2005.
+
+package javax.annotation;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * The PostConstruct annotation is used on a method that needs to be executed
+ * after dependency injection is done to perform any initialization. This
+ * method MUST be invoked before the class is put into service. This
+ * annotation MUST be supported on all classes that support dependency
+ * injection. The method annotated with PostConstruct MUST be invoked even
+ * if the class does not request any resources to be injected. Only one
+ * method can be annotated with this annotation. The method on which the
+ * PostConstruct annotation is applied MUST fulfill all of the following
+ * criteria -
+- The method MUST NOT have any parameters except in the case of EJB
+ * interceptors in which case it takes an InvocationC ontext object as
+ * defined by the EJB specification.
+ * - The return type of the method MUST be void.
+ * - The method MUST NOT throw a checked exception.
+ * - The method on which PostConstruct is applied MAY be public, protected,
+ * package private or private.
+ * - The method MUST NOT be static except for the application client.
+ * - The method MAY be final.
+ * - If the method throws an unchecked exception the class MUST NOT be put into
+ * service except in the case of EJBs where the EJB can handle exceptions and
+ * even recover from them.
+ * @since Common Annotations 1.0
+ * @see javax.annotation.PreDestroy
+ * @see javax.annotation.Resource
+ */
+@Documented
+@Retention (RUNTIME)
+@Target(METHOD)
+public @interface PostConstruct {
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/PreDestroy.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/PreDestroy.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/PreDestroy.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+//Copyright Sun Microsystems Inc. 2004 - 2005.
+
+package javax.annotation;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * The PreDestroy annotation is used on methods as a callback notification to
+ * signal that the instance is in the process of being removed by the
+ * container. The method annotated with PreDestroy is typically used to
+ * release resources that it has been holding. This annotation MUST be
+ * supported by all container managed objects that support PostConstruct
+ * except the application client container in Java EE 5. The method on which
+ * the PreDestroy annotation is applied MUST fulfill all of the following
+ * criteria -
+ * - The method MUST NOT have any parameters except in the case of EJB
+ * interceptors in which case it takes an InvocationContext object as defined
+ * by the EJB specification.
+ * - The return type of the method MUST be void.
+ * - The method MUST NOT throw a checked exception.
+ * - The method on which PreDestroy is applied MAY be public, protected,
+ * package private or private.
+ * - The method MUST NOT be static.
+ * - The method MAY be final.
+ * - If the method throws an unchecked exception it is ignored except in the
+ * case of EJBs where the EJB can handle exceptions.
+ *
+ * @see javax.annotation.PostConstruct
+ * @see javax.annotation.Resource
+ * @since Common Annotations 1.0
+ */
+
+@Documented
+@Retention (RUNTIME)
+@Target(METHOD)
+public @interface PreDestroy {
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/Resource.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/Resource.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/Resource.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+//Copyright Sun Microsystems Inc. 2004 - 2005.
+
+package javax.annotation;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * The Resource annotation marks a resource that is needed
+ * by the application. This annotation may be applied to an
+ * application component class, or to fields or methods of the
+ * component class. When the annotation is applied to a
+ * field or method, the container will inject an instance
+ * of the requested resource into the application component
+ * when the component is initialized. If the annotation is
+ * applied to the component class, the annotation declares a
+ * resource that the application will look up at runtime. <p>
+ *
+ * Even though this annotation is not marked Inherited, deployment
+ * tools are required to examine all superclasses of any component
+ * class to discover all uses of this annotation in all superclasses.
+ * All such annotation instances specify resources that are needed
+ * by the application component. Note that this annotation may
+ * appear on private fields and methods of superclasses; the container
+ * is required to perform injection in these cases as well.
+ *
+ * @since Common Annotations 1.0
+ */
+@Target({TYPE, FIELD, METHOD})
+@Retention(RUNTIME)
+public @interface Resource {
+ /**
+ * The JNDI name of the resource. For field annotations,
+ * the default is the field name. For method annotations,
+ * the default is the JavaBeans property name corresponding
+ * to the method. For class annotations, there is no default
+ * and this must be specified.
+ */
+ String name() default "";
+
+ /**
+ * The Java type of the resource. For field annotations,
+ * the default is the type of the field. For method annotations,
+ * the default is the type of the JavaBeans property.
+ * For class annotations, there is no default and this must be
+ * specified.
+ */
+ Class type() default java.lang.Object.class;
+
+ /**
+ * The two possible authentication types for a resource.
+ */
+ enum AuthenticationType {
+ CONTAINER,
+ APPLICATION
+ }
+
+ /**
+ * The authentication type to use for this resource.
+ * This may be specified for resources representing a
+ * connection factory of any supported type, and must
+ * not be specified for resources of other types.
+ */
+ AuthenticationType authenticationType() default AuthenticationType.CONTAINER;
+
+ /**
+ * Indicates whether this resource can be shared between
+ * this component and other components.
+ * This may be specified for resources representing a
+ * connection factory of any supported type, and must
+ * not be specified for resources of other types.
+ */
+ boolean shareable() default true;
+
+ /**
+ * A product specific name that this resource should be mapped to.
+ * The name of this resource, as defined by the <code>name</code>
+ * element or defaulted, is a name that is local to the application
+ * component using the resource. (It's a name in the JNDI
+ * <code>java:comp/env</code> namespace.) Many application servers
+ * provide a way to map these local names to names of resources
+ * known to the application server. This mapped name is often a
+ * <i>global</i> JNDI name, but may be a name of any form. <p>
+ *
+ * Application servers are not required to support any particular
+ * form or type of mapped name, nor the ability to use mapped names.
+ * The mapped name is product-dependent and often installation-dependent.
+ * No use of a mapped name is portable.
+ */
+ String mappedName() default "";
+
+ /**
+ * Description of this resource. The description is expected
+ * to be in the default language of the system on which the
+ * application is deployed. The description can be presented
+ * to the Deployer to help in choosing the correct resource.
+ */
+ String description() default "";
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/Resources.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/Resources.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/Resources.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+//Copyright Sun Microsystems Inc. 2004 - 2005.
+
+package javax.annotation;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * This class is used to allow multiple resources declarations.
+ *
+ * @see javax.annotation.Resource
+ * @since Common Annotations 1.0
+ */
+
+@Documented
+@Retention(RUNTIME)
+@Target(TYPE)
+public @interface Resources {
+ /**
+ * Array used for multiple resource declarations.
+ */
+ Resource[] value();
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/processing/AbstractProcessor.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/processing/AbstractProcessor.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/processing/AbstractProcessor.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.annotation.processing;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import javax.lang.model.element.*;
+import javax.lang.model.SourceVersion;
+import javax.tools.Diagnostic;
+
+/**
+ * An abstract annotation processor designed to be a convenient
+ * superclass for most concrete annotation processors. This class
+ * examines annotation values to compute the {@linkplain
+ * #getSupportedOptions options}, {@linkplain
+ * #getSupportedAnnotationTypes annotations}, and {@linkplain
+ * #getSupportedSourceVersion source version} supported by its
+ * subtypes.
+ *
+ * <p>The getter methods may {@linkplain Messager#printMessage issue
+ * warnings} about noteworthy conditions using the facilities available
+ * after the processor has been {@linkplain #isInitialized
+ * initialized}.
+ *
+ * <p>Subclasses are free to override the implementation and
+ * specification of any of the methods in this class as long as the
+ * general {@link javax.annotation.processing.Processor Processor}
+ * contract for that method is obeyed.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @author Peter von der Ahé
+ * @version 1.14 07/05/05
+ * @since 1.6
+ */
+public abstract class AbstractProcessor implements Processor {
+ /**
+ * Processing environment providing by the tool framework.
+ */
+ protected ProcessingEnvironment processingEnv;
+ private boolean initialized = false;
+
+ /**
+ * Constructor for subclasses to call.
+ */
+ protected AbstractProcessor() {}
+
+ /**
+ * If the processor class is annotated with {@link
+ * SupportedOptions}, return an unmodifiable set with the same set
+ * of strings as the annotation. If the class is not so
+ * annotated, an empty set is returned.
+ *
+ * @return the options recognized by this processor, or an empty
+ * set if none
+ */
+ public Set<String> getSupportedOptions() {
+ SupportedOptions so = this.getClass().getAnnotation(SupportedOptions.class);
+ if (so == null)
+ return Collections.emptySet();
+ else
+ return arrayToSet(so.value());
+ }
+
+ /**
+ * If the processor class is annotated with {@link
+ * SupportedAnnotationTypes}, return an unmodifiable set with the
+ * same set of strings as the annotation. If the class is not so
+ * annotated, an empty set is returned.
+ *
+ * @return the names of the annotation types supported by this
+ * processor, or an empty set if none
+ */
+ public Set<String> getSupportedAnnotationTypes() {
+ SupportedAnnotationTypes sat = this.getClass().getAnnotation(SupportedAnnotationTypes.class);
+ if (sat == null) {
+ if (isInitialized())
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING,
+ "No SupportedAnnotationTypes annotation " +
+ "found on " + this.getClass().getName() +
+ ", returning an empty set.");
+ return Collections.emptySet();
+ }
+ else
+ return arrayToSet(sat.value());
+ }
+
+ /**
+ * If the processor class is annotated with {@link
+ * SupportedSourceVersion}, return the source version in the
+ * annotation. If the class is not so annotated, {@link
+ * SourceVersion#RELEASE_6} is returned.
+ *
+ * @return the latest source version supported by this processor
+ */
+ public SourceVersion getSupportedSourceVersion() {
+ SupportedSourceVersion ssv = this.getClass().getAnnotation(SupportedSourceVersion.class);
+ SourceVersion sv = null;
+ if (ssv == null) {
+ sv = SourceVersion.RELEASE_6;
+ if (isInitialized())
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING,
+ "No SupportedSourceVersion annotation " +
+ "found on " + this.getClass().getName() +
+ ", returning " + sv + ".");
+ } else
+ sv = ssv.value();
+ return sv;
+ }
+
+
+ /**
+ * Initializes the processor with the processing environment by
+ * setting the {@code processingEnv} field to the value of the
+ * {@code processingEnv} argument. An {@code
+ * IllegalStateException} will be thrown if this method is called
+ * more than once on the same object.
+ *
+ * @param processingEnv environment to access facilities the tool framework
+ * provides to the processor
+ * @throws IllegalStateException if this method is called more than once.
+ */
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ if (initialized)
+ throw new IllegalStateException("Cannot call init more than once.");
+ if (processingEnv == null)
+ throw new NullPointerException("Tool provided null ProcessingEnvironment");
+
+ this.processingEnv = processingEnv;
+ initialized = true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract boolean process(Set<? extends TypeElement> annotations,
+ RoundEnvironment roundEnv);
+
+ /**
+ * Returns an empty iterable of completions.
+ *
+ * @param element {@inheritDoc}
+ * @param annotation {@inheritDoc}
+ * @param member {@inheritDoc}
+ * @param userText {@inheritDoc}
+ */
+ public Iterable<? extends Completion> getCompletions(Element element,
+ AnnotationMirror annotation,
+ ExecutableElement member,
+ String userText) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * Returns {@code true} if this object has been {@linkplain #init
+ * initialized}, {@code false} otherwise.
+ *
+ * @return {@code true} if this object has been initialized,
+ * {@code false} otherwise.
+ */
+ protected synchronized boolean isInitialized() {
+ return initialized;
+ }
+
+ private static Set<String> arrayToSet(String[] array) {
+ assert array != null;
+ Set<String> set = new HashSet<String>(array.length);
+ for (String s : array)
+ set.add(s);
+ return Collections.unmodifiableSet(set);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/processing/Completion.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/processing/Completion.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/processing/Completion.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.annotation.processing;
+
+/**
+ * A suggested {@linkplain Processor#getCompletions <em>completion</em>} for an
+ * annotation. A completion is text meant to be inserted into a
+ * program as part of an annotation.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @author Peter von der Ahé
+ * @version 1.8 07/05/05
+ * @since 1.6
+ */
+public interface Completion {
+
+ /**
+ * Returns the text of the suggested completion.
+ * @return the text of the suggested completion.
+ */
+ String getValue();
+
+ /**
+ * Returns an informative message about the completion.
+ * @return an informative message about the completion.
+ */
+ String getMessage();
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/processing/Completions.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/processing/Completions.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/processing/Completions.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.annotation.processing;
+
+import java.util.Arrays;
+
+/**
+ * Utility class for assembling {@link Completion} objects.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @author Peter von der Ahé
+ * @version 1.8 07/05/05
+ * @since 1.6
+ */
+public class Completions {
+ // No instances for you.
+ private Completions() {}
+
+ private static class SimpleCompletion implements Completion {
+ private String value;
+ private String message;
+
+ SimpleCompletion(String value, String message) {
+ if (value == null || message == null)
+ throw new NullPointerException("Null completion strings not accepted.");
+ this.value = value;
+ this.message = message;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+
+ public String getMessage() {
+ return message;
+ }
+
+ @Override
+ public String toString() {
+ return "[\"" + value + "\", \"" + message + "\"]";
+ }
+ // Default equals and hashCode are fine.
+ }
+
+ /**
+ * Returns a completion of the value and message.
+ *
+ * @param value the text of the completion
+ * @param message a message about the completion
+ * @return a completion of the provided value and message
+ */
+ public static Completion of(String value, String message) {
+ return new SimpleCompletion(value, message);
+ }
+
+ /**
+ * Returns a completion of the value and an empty message
+ *
+ * @param value the text of the completion
+ * @return a completion of the value and an empty message
+ */
+ public static Completion of(String value) {
+ return new SimpleCompletion(value, "");
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/processing/Filer.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/processing/Filer.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/processing/Filer.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.annotation.processing;
+
+import javax.tools.JavaFileManager;
+import javax.tools.*;
+import javax.lang.model.element.Element;
+import java.io.IOException;
+
+/**
+ * This interface supports the creation of new files by an annotation
+ * processor. Files created in this way will be known to the
+ * annotation processing tool implementing this interface, better
+ * enabling the tool to manage them. Source and class files so
+ * created will be considered for processing by the tool after the
+ * {@code close} method has been called on the {@code Writer} or
+ * {@code OutputStream} used to write the contents of the file.
+ *
+ * Three kinds of files are distinguished: source files, class files,
+ * and auxiliary resource files.
+ *
+ * <p> There are two distinguished supported locations (subtrees
+ * within the logical file system) where newly created files are
+ * placed: one for {@linkplain
+ * javax.tools.StandardLocation#SOURCE_OUTPUT new source files}, and
+ * one for {@linkplain javax.tools.StandardLocation#CLASS_OUTPUT new
+ * class files}. (These might be specified on a tool's command line,
+ * for example, using flags such as {@code -s} and {@code -d}.) The
+ * actual locations for new source files and new class files may or
+ * may not be distinct on a particular run of the tool. Resource
+ * files may be created in either location. The methods for reading
+ * and writing resources take a relative name argument. A relative
+ * name is a non-null, non-empty sequence of path segments separated
+ * by {@code '/'}; {@code '.'} and {@code '..'} are invalid path
+ * segments. A valid relative name must match the
+ * "path-rootless" rule of <a
+ * href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>, section
+ * 3.3.
+ *
+ * <p>The file creation methods take a variable number of arguments to
+ * allow the <em>originating elements</em> to be provided as hints to
+ * the tool infrastructure to better manage dependencies. The
+ * originating elements are the types or packages (representing {@code
+ * package-info} files) which caused an annotation processor to
+ * attempt to create a new file. For example, if an annotation
+ * processor tries to create a source file, {@code
+ * GeneratedFromUserSource}, in response to processing
+ *
+ * <blockquote><pre>
+ * @Generate
+ * public class UserSource {}
+ * </pre></blockquote>
+ *
+ * the type element for {@code UserSource} should be passed as part of
+ * the creation method call as in:
+ *
+ * <blockquote><pre>
+ * filer.createSourceFile("GeneratedFromUserSource",
+ * eltUtils.getTypeElement("UserSource"));
+ * </pre></blockquote>
+ *
+ * If there are no originating elements, none need to be passed. This
+ * information may be used in an incremental environment to determine
+ * the need to rerun processors or remove generated files.
+ * Non-incremental environments may ignore the originating element
+ * information.
+ *
+ * <p> During each run of an annotation processing tool, a file with a
+ * given pathname may be created only once. If that file already
+ * exists before the first attempt to create it, the old contents will
+ * be deleted. Any subsequent attempt to create the same file during
+ * a run will throw a {@link FilerException}, as will attempting to
+ * create both a class file and source file for the same type name or
+ * same package name. The {@linkplain Processor initial inputs} to
+ * the tool are considered to be created by the zeroth round;
+ * therefore, attempting to create a source or class file
+ * corresponding to one of those inputs will result in a {@link
+ * FilerException}.
+ *
+ * <p> In general, processors must not knowingly attempt to overwrite
+ * existing files that were not generated by some processor. A {@code
+ * Filer} may reject attempts to open a file corresponding to an
+ * existing type, like {@code java.lang.Object}. Likewise, the
+ * invoker of the annotation processing tool must not knowingly
+ * configure the tool such that the discovered processors will attempt
+ * to overwrite existing files that were not generated.
+ *
+ * <p> Processors can indicate a source or class file is generated by
+ * including an {@link javax.annotation.Generated @Generated}
+ * annotation.
+ *
+ * <p> Note that some of the effect of overwriting a file can be
+ * achieved by using a <i>decorator</i>-style pattern. Instead of
+ * modifying a class directly, the class is designed so that either
+ * its superclass is generated by annotation processing or subclasses
+ * of the class are generated by annotation processing. If the
+ * subclasses are generated, the parent class may be designed to use
+ * factories instead of public constructors so that only subclass
+ * instances would be presented to clients of the parent class.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @author Peter von der Ahé
+ * @version 1.16 07/05/05
+ * @since 1.6
+ */
+public interface Filer {
+ /**
+ * Creates a new source file and returns an object to allow
+ * writing to it. The file's name and path (relative to the
+ * {@linkplain StandardLocation#SOURCE_OUTPUT root output location
+ * for source files}) are based on the type to be declared in that
+ * file. If more than one type is being declared, the name of the
+ * principal top-level type (the public one, for example) should
+ * be used. A source file can also be created to hold information
+ * about a package, including package annotations. To create a
+ * source file for a named package, have {@code name} be the
+ * package's name followed by {@code ".package-info"}; to create a
+ * source file for an unnamed package, use {@code "package-info"}.
+ *
+ * <p> Note that to use a particular {@linkplain
+ * java.nio.charset.Charset charset} to encode the contents of the
+ * file, an {@code OutputStreamWriter} with the chosen charset can
+ * be created from the {@code OutputStream} from the returned
+ * object. If the {@code Writer} from the returned object is
+ * directly used for writing, its charset is determined by the
+ * implementation. An annotation processing tool may have an
+ * {@code -encoding} flag or analogous option for specifying this;
+ * otherwise, it will typically be the platform's default
+ * encoding.
+ *
+ * <p>To avoid subsequent errors, the contents of the source file
+ * should be compatible with the {@linkplain
+ * ProcessingEnvironment#getSourceVersion source version} being used
+ * for this run.
+ *
+ * @param name canonical (fully qualified) name of the principal type
+ * being declared in this file or a package name followed by
+ * {@code ".package-info"} for a package information file
+ * @param originatingElements type or package elements causally
+ * associated with the creation of this file, may be elided or
+ * {@code null}
+ * @return a {@code JavaFileObject} to write the new source file
+ * @throws FilerException if the same pathname has already been
+ * created, the same type has already been created, or the name is
+ * not valid for a type
+ * @throws IOException if the file cannot be created
+ */
+ JavaFileObject createSourceFile(CharSequence name,
+ Element... originatingElements) throws IOException;
+
+ /**
+ * Creates a new class file, and returns an object to allow
+ * writing to it. The file's name and path (relative to the
+ * {@linkplain StandardLocation#CLASS_OUTPUT root output location
+ * for class files}) are based on the name of the type being
+ * written. A class file can also be created to hold information
+ * about a package, including package annotations. To create a
+ * class file for a named package, have {@code name} be the
+ * package's name followed by {@code ".package-info"}; creating a
+ * class file for an unnamed package is not supported.
+ *
+ * <p>To avoid subsequent errors, the contents of the class file
+ * should be compatible with the {@linkplain
+ * ProcessingEnvironment#getSourceVersion source version} being used
+ * for this run.
+ *
+ * @param name binary name of the type being written or a package name followed by
+ * {@code ".package-info"} for a package information file
+ * @param originatingElements type or package elements causally
+ * associated with the creation of this file, may be elided or
+ * {@code null}
+ * @return a {@code JavaFileObject} to write the new class file
+ * @throws FilerException if the same pathname has already been
+ * created, the same type has already been created, or the name is
+ * not valid for a type
+ * @throws IOException if the file cannot be created
+ */
+ JavaFileObject createClassFile(CharSequence name,
+ Element... originatingElements) throws IOException;
+
+ /**
+ * Creates a new auxiliary resource file for writing and returns a
+ * file object for it. The file may be located along with the
+ * newly created source files, newly created binary files, or
+ * other supported location. The locations {@link
+ * StandardLocation#CLASS_OUTPUT CLASS_OUTPUT} and {@link
+ * StandardLocation#SOURCE_OUTPUT SOURCE_OUTPUT} must be
+ * supported. The resource may be named relative to some package
+ * (as are source and class files), and from there by a relative
+ * pathname. In a loose sense, the full pathname of the new file
+ * will be the concatenation of {@code location}, {@code pkg}, and
+ * {@code relativeName}.
+ *
+ * <p>Files created via this method are not registered for
+ * annotation processing, even if the full pathname of the file
+ * would correspond to the full pathname of a new source file
+ * or new class file.
+ *
+ * @param location location of the new file
+ * @param pkg package relative to which the file should be named,
+ * or the empty string if none
+ * @param relativeName final pathname components of the file
+ * @param originatingElements type or package elements causally
+ * associated with the creation of this file, may be elided or
+ * {@code null}
+ * @return a {@code FileObject} to write the new resource
+ * @throws IOException if the file cannot be created
+ * @throws FilerException if the same pathname has already been
+ * created
+ * @throws IllegalArgumentException for an unsupported location
+ * @throws IllegalArgumentException if {@code relativeName} is not relative
+ */
+ FileObject createResource(JavaFileManager.Location location,
+ CharSequence pkg,
+ CharSequence relativeName,
+ Element... originatingElements) throws IOException;
+
+ /**
+ * Returns an object for reading an existing resource. The
+ * locations {@link StandardLocation#CLASS_OUTPUT CLASS_OUTPUT}
+ * and {@link StandardLocation#SOURCE_OUTPUT SOURCE_OUTPUT} must
+ * be supported.
+ *
+ * @param location location of the file
+ * @param pkg package relative to which the file should be searched,
+ * or the empty string if none
+ * @param relativeName final pathname components of the file
+ * @return an object to read the file
+ * @throws FilerException if the same pathname has already been
+ * opened for writing
+ * @throws IOException if the file cannot be opened
+ * @throws IllegalArgumentException for an unsupported location
+ * @throws IllegalArgumentException if {@code relativeName} is not relative
+ */
+ FileObject getResource(JavaFileManager.Location location,
+ CharSequence pkg,
+ CharSequence relativeName) throws IOException;
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/processing/FilerException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/processing/FilerException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/processing/FilerException.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.annotation.processing;
+
+import java.io.IOException;
+import javax.annotation.processing.Filer;
+
+/**
+ * Indicates a {@link Filer} detected an attempt to open a file that
+ * would violate the guarantees provided by the {@code Filer}. Those
+ * guarantees include not creating the same file more than once, not
+ * creating multiple files corresponding to the same type, and not
+ * creating files for types with invalid names.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @author Peter von der Ahé
+ * @version 1.12 07/05/05
+ * @since 1.6
+ */
+public class FilerException extends IOException {
+ static final long serialVersionUID = 8426423106453163293L;
+ /**
+ * Constructs an exception with the specified detail message.
+ * @param s the detail message, which should include the name of
+ * the file attempting to be opened; may be {@code null}
+ */
+ public FilerException(String s) {
+ super(s);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/processing/Messager.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/processing/Messager.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/processing/Messager.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.annotation.processing;
+
+import javax.annotation.*;
+import javax.tools.Diagnostic;
+import javax.lang.model.element.*;
+
+/**
+ * A {@code Messager} provides the way for an annotation processor to
+ * report error messages, warnings, and other notices. Elements,
+ * annotations, and annotation values can be passed to provide a
+ * location hint for the message. However, such location hints may be
+ * unavailable or only approximate.
+ *
+ * <p>Printing a message with an {@linkplain
+ * javax.tools.Diagnostic.Kind#ERROR error kind} will {@linkplain
+ * RoundEnvironment#errorRaised raise an error}.
+ *
+ * <p>Note that the messages "printed" by methods in this
+ * interface may or may not appear as textual output to a location
+ * like {@link System#out} or {@link System#err}. Implementations may
+ * choose to present this information in a different fashion, such as
+ * messages in a window.
+ *
+ * @author Joseph D. Darcy
+ * @author Scott Seligman
+ * @author Peter von der Ahé
+ * @version 1.13 07/05/05
+ * @see ProcessingEnvironment#getLocale
+ * @since 1.6
+ */
+public interface Messager {
+ /**
+ * Prints a message of the specified kind.
+ *
+ * @param kind the kind of message
+ * @param msg the message, or an empty string if none
+ */
+ void printMessage(Diagnostic.Kind kind, CharSequence msg);
+
+ /**
+ * Prints a message of the specified kind at the location of the
+ * element.
+ *
+ * @param kind the kind of message
+ * @param msg the message, or an empty string if none
+ * @param e the element to use as a position hint
+ */
+ void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e);
+
+ /**
+ * Prints a message of the specified kind at the location of the
+ * annotation mirror of the annotated element.
+ *
+ * @param kind the kind of message
+ * @param msg the message, or an empty string if none
+ * @param e the annotated element
+ * @param a the annotation to use as a position hint
+ */
+ void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a);
+
+ /**
+ * Prints a message of the specified kind at the location of the
+ * annotation value inside the annotation mirror of the annotated
+ * element.
+ *
+ * @param kind the kind of message
+ * @param msg the message, or an empty string if none
+ * @param e the annotated element
+ * @param a the annotation containing the annotation value
+ * @param v the annotation value to use as a position hint
+ */
+ void printMessage(Diagnostic.Kind kind,
+ CharSequence msg,
+ Element e,
+ AnnotationMirror a,
+ AnnotationValue v);
+}
Added: trunk/core/src/openjdk/javax/javax/annotation/processing/ProcessingEnvironment.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/annotation/processing/ProcessingEnvironment.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/annotation/processing/ProcessingEnvironment.java 2007-06-10 12:22:23 UTC (rev 3239)
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.annotation.processing;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Locale;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
+import java.io.File;
+
+/**
+ * An annotation processing tool framework will {@linkplain
+ * Processor#init provide an annotation processor with an object
+ * implementing this interface} so the processor can use facilities
+ * provided by the framework to write new files, report error
+ * messages, and find other utilities.
+ *
+ * <p>Third parties may wish to provide value-add wrappers around the
+ * faci...
[truncated message content] |
|
From: <ls...@us...> - 2007-06-10 12:20:13
|
Revision: 3238
http://jnode.svn.sourceforge.net/jnode/?rev=3238&view=rev
Author: lsantha
Date: 2007-06-10 05:20:11 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/Class.java
Modified: trunk/core/src/classpath/vm/java/lang/Class.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/Class.java 2007-06-10 12:19:09 UTC (rev 3237)
+++ trunk/core/src/classpath/vm/java/lang/Class.java 2007-06-10 12:20:11 UTC (rev 3238)
@@ -94,7 +94,7 @@
*
* @serialData Class objects serialize specially:
* <code>TC_CLASS ClassDescriptor</code>. For more serialization information,
- * see {@link ObjectStreamClass}.
+ * see {@link java.io.ObjectStreamClass}.
*
* @author John Keiser
* @author Eric Blake (eb...@em...)
@@ -618,7 +618,7 @@
* @throws NoSuchMethodException
* @throws SecurityException
*/
- public Method getMethod(String name, Class< ? >[] argTypes)
+ public Method getMethod(String name, Class<?>... argTypes)
throws NoSuchMethodException, SecurityException {
VmType< ? >[] vmArgTypes;
if (argTypes == null) {
@@ -1282,4 +1282,40 @@
return "";
return name.substring(0, lastInd);
}
+
+ /**
+ * Returns true if this class is an <code>Annotation</code>.
+ *
+ * @return true if this is an annotation class.
+ * @since 1.5
+ */
+ public boolean isAnnotation()
+ {
+ //todo implement it
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCanonicalName() {
+ //todo implement it
+ throw new UnsupportedOperationException();
+ /*
+ if (vmClass.isArray())
+ {
+ String componentName = vmClass.getComponentType().getCanonicalName();
+ if (componentName != null)
+ return componentName + "[]";
+ }
+ if (vmClass.isMemberClass(klass))
+ {
+ String memberName = getDeclaringClass(klass).getCanonicalName();
+ if (memberName != null)
+ return memberName + "." + getSimpleName(klass);
+ }
+ if (isLocalClass(klass) || vmClass.isAnonymousClass(klass))
+ return null;
+ return getName(klass);
+ */
+ }
+
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 12:19:10
|
Revision: 3237
http://jnode.svn.sourceforge.net/jnode/?rev=3237&view=rev
Author: lsantha
Date: 2007-06-10 05:19:09 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/VMThrowable.java
Modified: trunk/core/src/classpath/vm/java/lang/VMThrowable.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMThrowable.java 2007-06-10 12:18:12 UTC (rev 3236)
+++ trunk/core/src/classpath/vm/java/lang/VMThrowable.java 2007-06-10 12:19:09 UTC (rev 3237)
@@ -21,7 +21,6 @@
package java.lang;
-import org.jnode.vm.VmSystem;
import org.jnode.vm.VmStackFrame;
import org.jnode.vm.classmgr.VmMethod;
import org.jnode.vm.classmgr.VmType;
@@ -78,20 +77,24 @@
*/
StackTraceElement[] getStackTrace(Throwable t)
{
- final VmStackFrame[] vm_trace = (VmStackFrame[]) backtrace;
- final int length = vm_trace.length;
- final StackTraceElement[] trace = new StackTraceElement[length];
- for(int i = length; i-- > 0; ){
- final VmStackFrame frame = vm_trace[i];
- final String location = frame.getLocationInfo();
- final int lineNumber = "?".equals(location) ? -1 : Integer.parseInt(location);
- final VmMethod method = frame.getMethod();
- final VmType<?> vmClass = (method == null) ? null : method.getDeclaringClass();
- final String fname = (vmClass == null) ? null : vmClass.getSourceFile();
- final String cname = (vmClass == null) ? "<unknown class>" : vmClass.getName();
- final String mname = (method == null) ? "<unknown method>" : method.getName();
- trace[i] = new StackTraceElement(fname, lineNumber, cname, mname, method.isNative());
- }
- return trace;
+ return backTrace2stackTrace(backtrace);
}
+
+ static StackTraceElement[] backTrace2stackTrace(Object[] backtrace) {
+ final VmStackFrame[] vm_trace = (VmStackFrame[]) backtrace;
+ final int length = vm_trace.length;
+ final StackTraceElement[] trace = new StackTraceElement[length];
+ for(int i = length; i-- > 0; ){
+ final VmStackFrame frame = vm_trace[i];
+ final String location = frame.getLocationInfo();
+ final int lineNumber = "?".equals(location) ? -1 : Integer.parseInt(location);
+ final VmMethod method = frame.getMethod();
+ final VmType<?> vmClass = (method == null) ? null : method.getDeclaringClass();
+ final String fname = (vmClass == null) ? null : vmClass.getSourceFile();
+ final String cname = (vmClass == null) ? "<unknown class>" : vmClass.getName();
+ final String mname = (method == null) ? "<unknown method>" : method.getName();
+ trace[i] = new StackTraceElement(fname, lineNumber, cname, mname, method.isNative());
+ }
+ return trace;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 12:18:14
|
Revision: 3236
http://jnode.svn.sourceforge.net/jnode/?rev=3236&view=rev
Author: lsantha
Date: 2007-06-10 05:18:12 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/Thread.java
Modified: trunk/core/src/classpath/vm/java/lang/Thread.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/Thread.java 2007-06-10 12:16:53 UTC (rev 3235)
+++ trunk/core/src/classpath/vm/java/lang/Thread.java 2007-06-10 12:18:12 UTC (rev 3236)
@@ -54,12 +54,12 @@
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete to version 1.4, with caveats. We do not
- * implement the deprecated (and dangerous) stop, suspend, and resume
- * methods. Security implementation is not complete.
- */
+* "The Java Language Specification", ISBN 0-201-63451-1
+* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+* Status: Believed complete to version 1.4, with caveats. We do not
+* implement the deprecated (and dangerous) stop, suspend, and resume
+* methods. Security implementation is not complete.
+*/
/**
* Thread represents a single thread of execution in the VM. When an
@@ -960,7 +960,7 @@
* @see ThreadDeath
* @see ThreadGroup#uncaughtException(Thread, Throwable)
* @see SecurityManager#checkAccess(Thread)
- * @see SecurityManager#checkPermission(Permission)
+ * @see SecurityManager#checkPermission(java.security.Permission)
* @deprecated unsafe operation, try not to use
*/
public final void stop()
@@ -993,7 +993,7 @@
* @see ThreadDeath
* @see ThreadGroup#uncaughtException(Thread, Throwable)
* @see SecurityManager#checkAccess(Thread)
- * @see SecurityManager#checkPermission(Permission)
+ * @see SecurityManager#checkPermission(java.security.Permission)
* @deprecated unsafe operation, try not to use
*/
public final void stop(Throwable t)
@@ -1225,6 +1225,26 @@
return vmThread.getId();
}
+ //openjdk
+ private static final StackTraceElement[] EMPTY_STACK_TRACE = new StackTraceElement[0];
+ //openjdk
+ public StackTraceElement[] getStackTrace() {
+ if (this != Thread.currentThread()) {
+ // check for getStackTrace permission
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkPermission(new RuntimePermission("getStackTrace"));
+ }
+ if (!isAlive()) {
+ return EMPTY_STACK_TRACE;
+ }
+ return VMThrowable.backTrace2stackTrace(VmThread.getStackTrace(vmThread));
+ } else {
+ // Don't need JVM help for current thread
+ return (new Exception()).getStackTrace();
+ }
+ }
+
/**
* <p>
* This interface is used to handle uncaught exceptions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 12:16:54
|
Revision: 3235
http://jnode.svn.sourceforge.net/jnode/?rev=3235&view=rev
Author: lsantha
Date: 2007-06-10 05:16:53 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/misc/ASCIICaseInsensitiveComparator.java
trunk/core/src/openjdk/sun/sun/misc/JavaIODeleteOnExitAccess.java
trunk/core/src/openjdk/sun/sun/misc/JavaUtilJarAccess.java
Added: trunk/core/src/openjdk/sun/sun/misc/ASCIICaseInsensitiveComparator.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/misc/ASCIICaseInsensitiveComparator.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/misc/ASCIICaseInsensitiveComparator.java 2007-06-10 12:16:53 UTC (rev 3235)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.misc;
+
+import java.util.Comparator;
+
+/** Implements a locale and case insensitive comparator suitable for
+ strings that are known to only contain ASCII characters. Some
+ tables internal to the JDK contain only ASCII data and are using
+ the "generalized" java.lang.String case-insensitive comparator
+ which converts each character to both upper and lower case. */
+
+public class ASCIICaseInsensitiveComparator implements Comparator {
+ public static final Comparator CASE_INSENSITIVE_ORDER =
+ new ASCIICaseInsensitiveComparator();
+
+ public int compare(Object o1, Object o2) {
+ String s1 = (String) o1;
+ String s2 = (String) o2;
+ int n1=s1.length(), n2=s2.length();
+ int minLen = n1 < n2 ? n1 : n2;
+ for (int i=0; i < minLen; i++) {
+ char c1 = s1.charAt(i);
+ char c2 = s2.charAt(i);
+ assert c1 <= '\u007F' && c2 <= '\u007F';
+ if (c1 != c2) {
+ c1 = (char)toLower(c1);
+ c2 = (char)toLower(c2);
+ if (c1 != c2) {
+ return c1 - c2;
+ }
+ }
+ }
+ return n1 - n2;
+ }
+
+ /**
+ * A case insensitive hash code method to go with the case insensitive
+ * compare() method.
+ *
+ * Returns a hash code for this ASCII string as if it were lower case.
+ *
+ * returns same answer as:<p>
+ * <code>s.toLowerCase(Locale.US).hashCode();</code><p>
+ * but does not allocate memory (it does NOT have the special
+ * case Turkish rules).
+ *
+ * @param s a String to compute the hashcode on.
+ * @return a hash code value for this object.
+ */
+ public static int lowerCaseHashCode(String s) {
+ int h = 0;
+ int len = s.length();
+
+ for (int i = 0; i < len; i++) {
+ h = 31*h + toLower(s.charAt(i));
+ }
+
+ return h;
+ }
+
+ /* If java.util.regex.ASCII ever becomes public or sun.*, use its code instead:*/
+ static boolean isLower(int ch) {
+ return ((ch-'a')|('z'-ch)) >= 0;
+ }
+
+ static boolean isUpper(int ch) {
+ return ((ch-'A')|('Z'-ch)) >= 0;
+ }
+
+ static int toLower(int ch) {
+ return isUpper(ch) ? (ch + 0x20) : ch;
+ }
+
+ static int toUpper(int ch) {
+ return isLower(ch) ? (ch - 0x20) : ch;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/misc/JavaIODeleteOnExitAccess.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/misc/JavaIODeleteOnExitAccess.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/misc/JavaIODeleteOnExitAccess.java 2007-06-10 12:16:53 UTC (rev 3235)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.misc;
+
+public interface JavaIODeleteOnExitAccess extends Runnable {
+ public void run();
+}
Added: trunk/core/src/openjdk/sun/sun/misc/JavaUtilJarAccess.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/misc/JavaUtilJarAccess.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/misc/JavaUtilJarAccess.java 2007-06-10 12:16:53 UTC (rev 3235)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.misc;
+
+import java.io.IOException;
+import java.util.jar.JarFile;
+
+public interface JavaUtilJarAccess {
+ public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 12:16:27
|
Revision: 3234
http://jnode.svn.sourceforge.net/jnode/?rev=3234&view=rev
Author: lsantha
Date: 2007-06-10 05:16:23 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
javac integration from openjdk in progress.
Modified Paths:
--------------
trunk/core/descriptors/ejc.xml
Added Paths:
-----------
trunk/core/descriptors/com.sun.tools.javac.xml
trunk/core/descriptors/javax.ext.tools.xml
Added: trunk/core/descriptors/com.sun.tools.javac.xml
===================================================================
--- trunk/core/descriptors/com.sun.tools.javac.xml (rev 0)
+++ trunk/core/descriptors/com.sun.tools.javac.xml 2007-06-10 12:16:23 UTC (rev 3234)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="com.sun.tools.javac"
+ name="The Java language compiler from Sun"
+ version="@VERSION@"
+ plugin-version="@VERSION@"
+ provider-name="Sun Microsystems"
+ provider-url="http://sun.com"
+ license-name="classpath">
+
+ <runtime>
+ <library name="jnode-core.jar">
+ <export name="com.sun.mirror.apt.*"/>
+ <export name="com.sun.mirror.declaration.*"/>
+ <export name="com.sun.mirror.type.*"/>
+ <export name="com.sun.mirror.util.*"/>
+ <export name="com.sun.source.tree.*"/>
+ <export name="com.sun.source.util.*"/>
+ <export name="com.sun.tools.apt.*"/>
+ <export name="com.sun.tools.apt.comp.*"/>
+ <export name="com.sun.tools.apt.main.*"/>
+ <export name="com.sun.tools.apt.mirror.*"/>
+ <export name="com.sun.tools.apt.mirror.apt.*"/>
+ <export name="com.sun.tools.apt.mirror.declaration.*"/>
+ <export name="com.sun.tools.apt.mirror.type.*"/>
+ <export name="com.sun.tools.apt.mirror.util.*"/>
+ <export name="com.sun.tools.apt.resources.*"/>
+ <export name="com.sun.tools.apt.util.*"/>
+ <export name="com.sun.tools.javac.*"/>
+ <export name="com.sun.tools.javac.api.*"/>
+ <export name="com.sun.tools.javac.code.*"/>
+ <export name="com.sun.tools.javac.comp.*"/>
+ <export name="com.sun.tools.javac.jvm.*"/>
+ <export name="com.sun.tools.javac.main.*"/>
+ <export name="com.sun.tools.javac.model.*"/>
+ <export name="com.sun.tools.javac.parser.*"/>
+ <export name="com.sun.tools.javac.processing.*"/>
+ <export name="com.sun.tools.javac.resources.*"/>
+ <export name="com.sun.tools.javac.services.*"/>
+ <export name="com.sun.tools.javac.sym.*"/>
+ <export name="com.sun.tools.javac.tree.*"/>
+ <export name="com.sun.tools.javac.util.*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="javac" class="com.sun.tools.javac.Main"/>
+ <alias name="apt" class="com.sun.tools.apt.Main"/>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.lang.RuntimePermission" name="getProtectionDomain"/>
+ <permission class="java.lang.RuntimePermission" name="createClassLoader"/>
+ <permission class="java.lang.RuntimePermission" name="setContextClassLoader"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="org.jnode.security.JNodePermission" name="getVmThread"/>
+ <permission class="org.jnode.security.JNodePermission" name="getVmClass"/>
+ <permission class="java.net.SocketPermission" name="*" actions="resolve"/>
+ <permission class="java.net.SocketPermission" name="*:0-" actions="connect,resolve"/>
+ <permission class="java.lang.RuntimePermission" name="writeFileDescriptor"/>
+ <permission class="java.lang.RuntimePermission" name="readFileDescriptor"/>
+ </extension>
+</plugin>
Modified: trunk/core/descriptors/ejc.xml
===================================================================
--- trunk/core/descriptors/ejc.xml 2007-06-10 08:45:45 UTC (rev 3233)
+++ trunk/core/descriptors/ejc.xml 2007-06-10 12:16:23 UTC (rev 3234)
@@ -19,7 +19,7 @@
</runtime>
<extension point="org.jnode.shell.aliases">
- <alias name="javac" class="org.eclipse.jdt.internal.compiler.batch.Main"/>
+ <alias name="ecj" class="org.eclipse.jdt.internal.compiler.batch.Main"/>
</extension>
<extension point="org.jnode.security.permissions">
Added: trunk/core/descriptors/javax.ext.tools.xml
===================================================================
--- trunk/core/descriptors/javax.ext.tools.xml (rev 0)
+++ trunk/core/descriptors/javax.ext.tools.xml 2007-06-10 12:16:23 UTC (rev 3234)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<fragment id="javax.ext.tools"
+ name="The javax.tools.* and related classes."
+ version="@VERSION@"
+ plugin-id="org.classpath.core"
+ plugin-version="@VERSION@"
+ provider-name="Sun Microsystems"
+ provider-url="http://sun.com"
+ license-name="classpath">
+
+ <runtime>
+ <library name="jnode-core.jar">
+ <export name="javax.annotation.*"/>
+ <export name="javax.annotation.processing.*"/>
+ <export name="javax.lang.model.*"/>
+ <export name="javax.lang.model.element.*"/>
+ <export name="javax.lang.model.type.*"/>
+ <export name="javax.lang.model.util.*"/>
+ <export name="javax.tools.*"/>
+ </library>
+ </runtime>
+
+</fragment>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 08:45:49
|
Revision: 3233
http://jnode.svn.sourceforge.net/jnode/?rev=3233&view=rev
Author: lsantha
Date: 2007-06-10 01:45:45 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
Added javap from openjdk.
Added Paths:
-----------
trunk/core/descriptors/sun.tools.xml
Added: trunk/core/descriptors/sun.tools.xml
===================================================================
--- trunk/core/descriptors/sun.tools.xml (rev 0)
+++ trunk/core/descriptors/sun.tools.xml 2007-06-10 08:45:45 UTC (rev 3233)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="sun.tools"
+ name="Core Java tools from Sun"
+ version="@VERSION@"
+ plugin-version="@VERSION@"
+ provider-name="Sun Microsystems"
+ provider-url="http://sun.com"
+ license-name="classpath">
+
+ <runtime>
+ <library name="jnode-core.jar">
+ <export name="sun.tools.asm.*"/>
+ <export name="sun.tools.java.*"/>
+ <export name="sun.tools.javac.*"/>
+ <export name="sun.tools.javac.resources.*"/>
+ <export name="sun.tools.javap.*"/>
+ <export name="sun.tools.javap.oldjavap.*"/>
+ <export name="sun.tools.tree.*"/>
+ <export name="sun.tools.util.*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="javap" class="sun.tools.javap.Main"/>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.lang.RuntimePermission" name="getProtectionDomain"/>
+ <permission class="java.lang.RuntimePermission" name="createClassLoader"/>
+ <permission class="java.lang.RuntimePermission" name="setContextClassLoader"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="org.jnode.security.JNodePermission" name="getVmThread"/>
+ <permission class="org.jnode.security.JNodePermission" name="getVmClass"/>
+ <permission class="java.net.SocketPermission" name="*" actions="resolve"/>
+ <permission class="java.net.SocketPermission" name="*:0-" actions="connect,resolve"/>
+ <permission class="java.lang.RuntimePermission" name="writeFileDescriptor"/>
+ <permission class="java.lang.RuntimePermission" name="readFileDescriptor"/>
+ </extension>
+</plugin>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-10 08:42:17
|
Revision: 3232
http://jnode.svn.sourceforge.net/jnode/?rev=3232&view=rev
Author: lsantha
Date: 2007-06-10 01:42:12 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
Added javap from openjdk.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/tools/
trunk/core/src/openjdk/sun/sun/tools/asm/
trunk/core/src/openjdk/sun/sun/tools/asm/ArrayData.java
trunk/core/src/openjdk/sun/sun/tools/asm/Assembler.java
trunk/core/src/openjdk/sun/sun/tools/asm/CatchData.java
trunk/core/src/openjdk/sun/sun/tools/asm/ClassConstantData.java
trunk/core/src/openjdk/sun/sun/tools/asm/ConstantPool.java
trunk/core/src/openjdk/sun/sun/tools/asm/ConstantPoolData.java
trunk/core/src/openjdk/sun/sun/tools/asm/Cover.java
trunk/core/src/openjdk/sun/sun/tools/asm/FieldConstantData.java
trunk/core/src/openjdk/sun/sun/tools/asm/Instruction.java
trunk/core/src/openjdk/sun/sun/tools/asm/Label.java
trunk/core/src/openjdk/sun/sun/tools/asm/LocalVariable.java
trunk/core/src/openjdk/sun/sun/tools/asm/LocalVariableTable.java
trunk/core/src/openjdk/sun/sun/tools/asm/NameAndTypeConstantData.java
trunk/core/src/openjdk/sun/sun/tools/asm/NameAndTypeData.java
trunk/core/src/openjdk/sun/sun/tools/asm/NumberConstantData.java
trunk/core/src/openjdk/sun/sun/tools/asm/StringConstantData.java
trunk/core/src/openjdk/sun/sun/tools/asm/StringExpressionConstantData.java
trunk/core/src/openjdk/sun/sun/tools/asm/SwitchData.java
trunk/core/src/openjdk/sun/sun/tools/asm/TryData.java
trunk/core/src/openjdk/sun/sun/tools/java/
trunk/core/src/openjdk/sun/sun/tools/java/AmbiguousClass.java
trunk/core/src/openjdk/sun/sun/tools/java/AmbiguousMember.java
trunk/core/src/openjdk/sun/sun/tools/java/ArrayType.java
trunk/core/src/openjdk/sun/sun/tools/java/BinaryAttribute.java
trunk/core/src/openjdk/sun/sun/tools/java/BinaryClass.java
trunk/core/src/openjdk/sun/sun/tools/java/BinaryCode.java
trunk/core/src/openjdk/sun/sun/tools/java/BinaryConstantPool.java
trunk/core/src/openjdk/sun/sun/tools/java/BinaryExceptionHandler.java
trunk/core/src/openjdk/sun/sun/tools/java/BinaryMember.java
trunk/core/src/openjdk/sun/sun/tools/java/ClassDeclaration.java
trunk/core/src/openjdk/sun/sun/tools/java/ClassDefinition.java
trunk/core/src/openjdk/sun/sun/tools/java/ClassFile.java
trunk/core/src/openjdk/sun/sun/tools/java/ClassNotFound.java
trunk/core/src/openjdk/sun/sun/tools/java/ClassPath.java
trunk/core/src/openjdk/sun/sun/tools/java/ClassType.java
trunk/core/src/openjdk/sun/sun/tools/java/CompilerError.java
trunk/core/src/openjdk/sun/sun/tools/java/Constants.java
trunk/core/src/openjdk/sun/sun/tools/java/Environment.java
trunk/core/src/openjdk/sun/sun/tools/java/Identifier.java
trunk/core/src/openjdk/sun/sun/tools/java/IdentifierToken.java
trunk/core/src/openjdk/sun/sun/tools/java/Imports.java
trunk/core/src/openjdk/sun/sun/tools/java/MemberDefinition.java
trunk/core/src/openjdk/sun/sun/tools/java/MethodSet.java
trunk/core/src/openjdk/sun/sun/tools/java/MethodType.java
trunk/core/src/openjdk/sun/sun/tools/java/Package.java
trunk/core/src/openjdk/sun/sun/tools/java/Parser.java
trunk/core/src/openjdk/sun/sun/tools/java/ParserActions.java
trunk/core/src/openjdk/sun/sun/tools/java/RuntimeConstants.java
trunk/core/src/openjdk/sun/sun/tools/java/Scanner.java
trunk/core/src/openjdk/sun/sun/tools/java/ScannerInputReader.java
trunk/core/src/openjdk/sun/sun/tools/java/SyntaxError.java
trunk/core/src/openjdk/sun/sun/tools/java/Type.java
trunk/core/src/openjdk/sun/sun/tools/javac/
trunk/core/src/openjdk/sun/sun/tools/javac/BatchEnvironment.java
trunk/core/src/openjdk/sun/sun/tools/javac/BatchParser.java
trunk/core/src/openjdk/sun/sun/tools/javac/CompilerMember.java
trunk/core/src/openjdk/sun/sun/tools/javac/ErrorConsumer.java
trunk/core/src/openjdk/sun/sun/tools/javac/ErrorMessage.java
trunk/core/src/openjdk/sun/sun/tools/javac/Main.java
trunk/core/src/openjdk/sun/sun/tools/javac/SourceClass.java
trunk/core/src/openjdk/sun/sun/tools/javac/SourceMember.java
trunk/core/src/openjdk/sun/sun/tools/javac/resources/
trunk/core/src/openjdk/sun/sun/tools/javac/resources/javac.properties
trunk/core/src/openjdk/sun/sun/tools/javac/resources/javac_ja.properties
trunk/core/src/openjdk/sun/sun/tools/javac/resources/javac_zh_CN.properties
trunk/core/src/openjdk/sun/sun/tools/javap/
trunk/core/src/openjdk/sun/sun/tools/javap/AttrData.java
trunk/core/src/openjdk/sun/sun/tools/javap/CPX.java
trunk/core/src/openjdk/sun/sun/tools/javap/CPX2.java
trunk/core/src/openjdk/sun/sun/tools/javap/ClassData.java
trunk/core/src/openjdk/sun/sun/tools/javap/Constants.java
trunk/core/src/openjdk/sun/sun/tools/javap/FieldData.java
trunk/core/src/openjdk/sun/sun/tools/javap/InnerClassData.java
trunk/core/src/openjdk/sun/sun/tools/javap/JavapEnvironment.java
trunk/core/src/openjdk/sun/sun/tools/javap/JavapPrinter.java
trunk/core/src/openjdk/sun/sun/tools/javap/LineNumData.java
trunk/core/src/openjdk/sun/sun/tools/javap/LocVarData.java
trunk/core/src/openjdk/sun/sun/tools/javap/Main.java
trunk/core/src/openjdk/sun/sun/tools/javap/MethodData.java
trunk/core/src/openjdk/sun/sun/tools/javap/RuntimeConstants.java
trunk/core/src/openjdk/sun/sun/tools/javap/StackMapData.java
trunk/core/src/openjdk/sun/sun/tools/javap/StackMapTableData.java
trunk/core/src/openjdk/sun/sun/tools/javap/Tables.java
trunk/core/src/openjdk/sun/sun/tools/javap/TrapData.java
trunk/core/src/openjdk/sun/sun/tools/javap/TypeSignature.java
trunk/core/src/openjdk/sun/sun/tools/javap/oldjavap/
trunk/core/src/openjdk/sun/sun/tools/javap/oldjavap/ConstantPrinter.java
trunk/core/src/openjdk/sun/sun/tools/javap/oldjavap/JavaP.java
trunk/core/src/openjdk/sun/sun/tools/javap/oldjavap/JavaPBinaryCode.java
trunk/core/src/openjdk/sun/sun/tools/javap/oldjavap/JavaPClassPrinter.java
trunk/core/src/openjdk/sun/sun/tools/javap/oldjavap/JavaPEnvironment.java
trunk/core/src/openjdk/sun/sun/tools/tree/
trunk/core/src/openjdk/sun/sun/tools/tree/AddExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AndExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ArrayAccessExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ArrayExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignAddExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignBitAndExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignBitOrExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignBitXorExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignDivideExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignMultiplyExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignOpExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignRemainderExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignShiftLeftExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignShiftRightExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignSubtractExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/AssignUnsignedShiftRightExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BinaryArithmeticExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BinaryAssignExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BinaryBitExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BinaryCompareExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BinaryEqualityExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BinaryExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BinaryLogicalExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BinaryShiftExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BitAndExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BitNotExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BitOrExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BitXorExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BooleanExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/BreakStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/ByteExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/CaseStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/CastExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/CatchStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/CharExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/CheckContext.java
trunk/core/src/openjdk/sun/sun/tools/tree/CodeContext.java
trunk/core/src/openjdk/sun/sun/tools/tree/CommaExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/CompoundStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/ConditionVars.java
trunk/core/src/openjdk/sun/sun/tools/tree/ConditionalExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ConstantExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/Context.java
trunk/core/src/openjdk/sun/sun/tools/tree/ContinueStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/ConvertExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/DeclarationStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/DivRemExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/DivideExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/DoStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/DoubleExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/EqualExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ExprExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/Expression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ExpressionStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/FieldExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/FieldUpdater.java
trunk/core/src/openjdk/sun/sun/tools/tree/FinallyStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/FloatExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ForStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/GreaterExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/GreaterOrEqualExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/IdentifierExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/IfStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/IncDecExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/InlineMethodExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/InlineNewInstanceExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/InlineReturnStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/InstanceOfExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/IntExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/IntegerExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/LengthExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/LessExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/LessOrEqualExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/LocalMember.java
trunk/core/src/openjdk/sun/sun/tools/tree/LongExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/MethodExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/MultiplyExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/NaryExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/NegativeExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/NewArrayExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/NewInstanceExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/Node.java
trunk/core/src/openjdk/sun/sun/tools/tree/NotEqualExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/NotExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/NullExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/OrExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/PositiveExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/PostDecExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/PostIncExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/PreDecExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/PreIncExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/RemainderExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ReturnStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/ShiftLeftExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ShiftRightExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ShortExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/Statement.java
trunk/core/src/openjdk/sun/sun/tools/tree/StringExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/SubtractExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/SuperExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/SwitchStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/SynchronizedStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/ThisExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/ThrowStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/TryStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/TypeExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/UnaryExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/UnsignedShiftRightExpression.java
trunk/core/src/openjdk/sun/sun/tools/tree/UplevelReference.java
trunk/core/src/openjdk/sun/sun/tools/tree/VarDeclarationStatement.java
trunk/core/src/openjdk/sun/sun/tools/tree/Vset.java
trunk/core/src/openjdk/sun/sun/tools/tree/WhileStatement.java
trunk/core/src/openjdk/sun/sun/tools/util/
trunk/core/src/openjdk/sun/sun/tools/util/CommandLine.java
trunk/core/src/openjdk/sun/sun/tools/util/ModifierFilter.java
Added: trunk/core/src/openjdk/sun/sun/tools/asm/ArrayData.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/tools/asm/ArrayData.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/tools/asm/ArrayData.java 2007-06-10 08:42:12 UTC (rev 3232)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 1995-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.tools.asm;
+
+import sun.tools.java.*;
+
+/**
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+public final
+class ArrayData {
+ Type type;
+ int nargs;
+
+ public ArrayData(Type type, int nargs) {
+ this.type = type;
+ this.nargs = nargs;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/tools/asm/Assembler.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/tools/asm/Assembler.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/tools/asm/Assembler.java 2007-06-10 08:42:12 UTC (rev 3232)
@@ -0,0 +1,957 @@
+/*
+ * Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.tools.asm;
+
+import sun.tools.java.*;
+import java.util.Enumeration;
+import java.io.IOException;
+import java.io.DataOutputStream;
+import java.io.PrintStream;
+import java.util.Vector;
+// JCOV
+import sun.tools.javac.*;
+import java.io.File;
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.lang.String;
+// end JCOV
+
+/**
+ * This class is used to assemble the bytecode instructions for a method.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ *
+ * @author Arthur van Hoff
+ * @version 1.41, 08/19/97
+ */
+public final
+class Assembler implements Constants {
+ static final int NOTREACHED = 0;
+ static final int REACHED = 1;
+ static final int NEEDED = 2;
+
+ Label first = new Label();
+ Instruction last = first;
+ int maxdepth;
+ int maxvar;
+ int maxpc;
+
+ /**
+ * Add an instruction
+ */
+ public void add(Instruction inst) {
+ if (inst != null) {
+ last.next = inst;
+ last = inst;
+ }
+ }
+ public void add(long where, int opc) {
+ add(new Instruction(where, opc, null));
+ }
+ public void add(long where, int opc, Object obj) {
+ add(new Instruction(where, opc, obj));
+ }
+// JCOV
+ public void add(long where, int opc, Object obj, boolean flagCondInverted) {
+ add(new Instruction(where, opc, obj, flagCondInverted));
+ }
+
+ public void add(boolean flagNoCovered, long where, int opc, Object obj) {
+ add(new Instruction(flagNoCovered, where, opc, obj));
+ }
+
+ public void add(long where, int opc, boolean flagNoCovered) {
+ add(new Instruction(where, opc, flagNoCovered));
+ }
+
+ static Vector SourceClassList = new Vector();
+
+ static Vector TmpCovTable = new Vector();
+
+ static int[] JcovClassCountArray = new int[CT_LAST_KIND + 1];
+
+ static String JcovMagicLine = "JCOV-DATA-FILE-VERSION: 2.0";
+ static String JcovClassLine = "CLASS: ";
+ static String JcovSrcfileLine = "SRCFILE: ";
+ static String JcovTimestampLine = "TIMESTAMP: ";
+ static String JcovDataLine = "DATA: ";
+ static String JcovHeadingLine = "#kind\tcount";
+
+ static int[] arrayModifiers =
+ {M_PUBLIC, M_PRIVATE, M_PROTECTED, M_ABSTRACT, M_FINAL, M_INTERFACE};
+ static int[] arrayModifiersOpc =
+ {PUBLIC, PRIVATE, PROTECTED, ABSTRACT, FINAL, INTERFACE};
+//end JCOV
+
+ /**
+ * Optimize instructions and mark those that can be reached
+ */
+ void optimize(Environment env, Label lbl) {
+ lbl.pc = REACHED;
+
+ for (Instruction inst = lbl.next ; inst != null ; inst = inst.next) {
+ switch (inst.pc) {
+ case NOTREACHED:
+ inst.optimize(env);
+ inst.pc = REACHED;
+ break;
+ case REACHED:
+ return;
+ case NEEDED:
+ break;
+ }
+
+ switch (inst.opc) {
+ case opc_label:
+ case opc_dead:
+ if (inst.pc == REACHED) {
+ inst.pc = NOTREACHED;
+ }
+ break;
+
+ case opc_ifeq:
+ case opc_ifne:
+ case opc_ifgt:
+ case opc_ifge:
+ case opc_iflt:
+ case opc_ifle:
+ case opc_if_icmpeq:
+ case opc_if_icmpne:
+ case opc_if_icmpgt:
+ case opc_if_icmpge:
+ case opc_if_icmplt:
+ case opc_if_icmple:
+ case opc_if_acmpeq:
+ case opc_if_acmpne:
+ case opc_ifnull:
+ case opc_ifnonnull:
+ optimize(env, (Label)inst.value);
+ break;
+
+ case opc_goto:
+ optimize(env, (Label)inst.value);
+ return;
+
+ case opc_jsr:
+ optimize(env, (Label)inst.value);
+ break;
+
+ case opc_ret:
+ case opc_return:
+ case opc_ireturn:
+ case opc_lreturn:
+ case opc_freturn:
+ case opc_dreturn:
+ case opc_areturn:
+ case opc_athrow:
+ return;
+
+ case opc_tableswitch:
+ case opc_lookupswitch: {
+ SwitchData sw = (SwitchData)inst.value;
+ optimize(env, sw.defaultLabel);
+ for (Enumeration e = sw.tab.elements() ; e.hasMoreElements();) {
+ optimize(env, (Label)e.nextElement());
+ }
+ return;
+ }
+
+ case opc_try: {
+ TryData td = (TryData)inst.value;
+ td.getEndLabel().pc = NEEDED;
+ for (Enumeration e = td.catches.elements() ; e.hasMoreElements();) {
+ CatchData cd = (CatchData)e.nextElement();
+ optimize(env, cd.getLabel());
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Eliminate instructions that are not reached
+ */
+ boolean eliminate() {
+ boolean change = false;
+ Instruction prev = first;
+
+ for (Instruction inst = first.next ; inst != null ; inst = inst.next) {
+ if (inst.pc != NOTREACHED) {
+ prev.next = inst;
+ prev = inst;
+ inst.pc = NOTREACHED;
+ } else {
+ change = true;
+ }
+ }
+ first.pc = NOTREACHED;
+ prev.next = null;
+ return change;
+ }
+
+ /**
+ * Optimize the byte codes
+ */
+ public void optimize(Environment env) {
+ //listing(System.out);
+ do {
+ // Figure out which instructions are reached
+ optimize(env, first);
+
+ // Eliminate instructions that are not reached
+ } while (eliminate() && env.opt());
+ }
+
+ /**
+ * Collect all constants into the constant table
+ */
+ public void collect(Environment env, MemberDefinition field, ConstantPool tab) {
+ // Collect constants for arguments only
+ // if a local variable table is generated
+ if ((field != null) && env.debug_vars()) {
+ if (field.getArguments() != null) {
+ for (Enumeration e = field.getArguments().elements() ; e.hasMoreElements() ;) {
+ MemberDefinition f = (MemberDefinition)e.nextElement();
+ tab.put(f.getName().toString());
+ tab.put(f.getType().getTypeSignature());
+ }
+ }
+ }
+
+ // Collect constants from the instructions
+ for (Instruction inst = first ; inst != null ; inst = inst.next) {
+ inst.collect(tab);
+ }
+ }
+
+ /**
+ * Determine stack size, count local variables
+ */
+ void balance(Label lbl, int depth) {
+ for (Instruction inst = lbl ; inst != null ; inst = inst.next) {
+ //Environment.debugOutput(inst.toString() + ": " + depth + " => " +
+ // (depth + inst.balance()));
+ depth += inst.balance();
+ if (depth < 0) {
+ throw new CompilerError("stack under flow: " + inst.toString() + " = " + depth);
+ }
+ if (depth > maxdepth) {
+ maxdepth = depth;
+ }
+ switch (inst.opc) {
+ case opc_label:
+ lbl = (Label)inst;
+ if (inst.pc == REACHED) {
+ if (lbl.depth != depth) {
+ throw new CompilerError("stack depth error " +
+ depth + "/" + lbl.depth +
+ ": " + inst.toString());
+ }
+ return;
+ }
+ lbl.pc = REACHED;
+ lbl.depth = depth;
+ break;
+
+ case opc_ifeq:
+ case opc_ifne:
+ case opc_ifgt:
+ case opc_ifge:
+ case opc_iflt:
+ case opc_ifle:
+ case opc_if_icmpeq:
+ case opc_if_icmpne:
+ case opc_if_icmpgt:
+ case opc_if_icmpge:
+ case opc_if_icmplt:
+ case opc_if_icmple:
+ case opc_if_acmpeq:
+ case opc_if_acmpne:
+ case opc_ifnull:
+ case opc_ifnonnull:
+ balance((Label)inst.value, depth);
+ break;
+
+ case opc_goto:
+ balance((Label)inst.value, depth);
+ return;
+
+ case opc_jsr:
+ balance((Label)inst.value, depth + 1);
+ break;
+
+ case opc_ret:
+ case opc_return:
+ case opc_ireturn:
+ case opc_lreturn:
+ case opc_freturn:
+ case opc_dreturn:
+ case opc_areturn:
+ case opc_athrow:
+ return;
+
+ case opc_iload:
+ case opc_fload:
+ case opc_aload:
+ case opc_istore:
+ case opc_fstore:
+ case opc_astore: {
+ int v = ((inst.value instanceof Number)
+ ? ((Number)inst.value).intValue()
+ : ((LocalVariable)inst.value).slot) + 1;
+ if (v > maxvar)
+ maxvar = v;
+ break;
+ }
+
+ case opc_lload:
+ case opc_dload:
+ case opc_lstore:
+ case opc_dstore: {
+ int v = ((inst.value instanceof Number)
+ ? ((Number)inst.value).intValue()
+ : ((LocalVariable)inst.value).slot) + 2;
+ if (v > maxvar)
+ maxvar = v;
+ break;
+ }
+
+ case opc_iinc: {
+ int v = ((int[])inst.value)[0] + 1;
+ if (v > maxvar)
+ maxvar = v + 1;
+ break;
+ }
+
+ case opc_tableswitch:
+ case opc_lookupswitch: {
+ SwitchData sw = (SwitchData)inst.value;
+ balance(sw.defaultLabel, depth);
+ for (Enumeration e = sw.tab.elements() ; e.hasMoreElements();) {
+ balance((Label)e.nextElement(), depth);
+ }
+ return;
+ }
+
+ case opc_try: {
+ TryData td = (TryData)inst.value;
+ for (Enumeration e = td.catches.elements() ; e.hasMoreElements();) {
+ CatchData cd = (CatchData)e.nextElement();
+ balance(cd.getLabel(), depth + 1);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Generate code
+ */
+ public void write(Environment env, DataOutputStream out,
+ MemberDefinition field, ConstantPool tab)
+ throws IOException {
+ //listing(System.out);
+
+ if ((field != null) && field.getArguments() != null) {
+ int sum = 0;
+ Vector v = field.getArguments();
+ for (Enumeration e = v.elements(); e.hasMoreElements(); ) {
+ MemberDefinition f = ((MemberDefinition)e.nextElement());
+ sum += f.getType().stackSize();
+ }
+ maxvar = sum;
+ }
+
+ // Make sure the stack balances. Also calculate maxvar and maxstack
+ try {
+ balance(first, 0);
+ } catch (CompilerError e) {
+ System.out.println("ERROR: " + e);
+ listing(System.out);
+ throw e;
+ }
+
+ // Assign PCs
+ int pc = 0, nexceptions = 0;
+ for (Instruction inst = first ; inst != null ; inst = inst.next) {
+ inst.pc = pc;
+ int sz = inst.size(tab);
+ if (pc<65536 && (pc+sz)>=65536) {
+ env.error(inst.where, "warn.method.too.long");
+ }
+ pc += sz;
+
+ if (inst.opc == opc_try) {
+ nexceptions += ((TryData)inst.value).catches.size();
+ }
+ }
+
+ // Write header
+ out.writeShort(maxdepth);
+ out.writeShort(maxvar);
+ out.writeInt(maxpc = pc);
+
+ // Generate code
+ for (Instruction inst = first.next ; inst != null ; inst = inst.next) {
+ inst.write(out, tab);
+ }
+
+ // write exceptions
+ out.writeShort(nexceptions);
+ if (nexceptions > 0) {
+ //listing(System.out);
+ writeExceptions(env, out, tab, first, last);
+ }
+ }
+
+ /**
+ * Write the exceptions table
+ */
+ void writeExceptions(Environment env, DataOutputStream out, ConstantPool tab, Instruction first, Instruction last) throws IOException {
+ for (Instruction inst = first ; inst != last.next ; inst = inst.next) {
+ if (inst.opc == opc_try) {
+ TryData td = (TryData)inst.value;
+ writeExceptions(env, out, tab, inst.next, td.getEndLabel());
+ for (Enumeration e = td.catches.elements() ; e.hasMoreElements();) {
+ CatchData cd = (CatchData)e.nextElement();
+ //System.out.println("EXCEPTION: " + env.getSource() + ", pc=" + inst.pc + ", end=" + td.getEndLabel().pc + ", hdl=" + cd.getLabel().pc + ", tp=" + cd.getType());
+ out.writeShort(inst.pc);
+ out.writeShort(td.getEndLabel().pc);
+ out.writeShort(cd.getLabel().pc);
+ if (cd.getType() != null) {
+ out.writeShort(tab.index(cd.getType()));
+ } else {
+ out.writeShort(0);
+ }
+ }
+ inst = td.getEndLabel();
+ }
+ }
+ }
+
+//JCOV
+ /**
+ * Write the coverage table
+ */
+ public void writeCoverageTable(Environment env, ClassDefinition c, DataOutputStream out, ConstantPool tab, long whereField) throws IOException {
+ Vector TableLot = new Vector(); /* Coverage table */
+ boolean begseg = false;
+ boolean begmeth = false;
+ long whereClass = ((SourceClass)c).getWhere();
+ Vector whereTry = new Vector();
+ int numberTry = 0;
+ int count = 0;
+
+ for (Instruction inst = first ; inst != null ; inst = inst.next) {
+ long n = (inst.where >> WHEREOFFSETBITS);
+ if (n > 0 && inst.opc != opc_label) {
+ if (!begmeth) {
+ if ( whereClass == inst.where)
+ TableLot.addElement(new Cover(CT_FIKT_METHOD, whereField, inst.pc));
+ else
+ TableLot.addElement(new Cover(CT_METHOD, whereField, inst.pc));
+ count++;
+ begmeth = true;
+ }
+ if (!begseg && !inst.flagNoCovered ) {
+ boolean findTry = false;
+ for (Enumeration e = whereTry.elements(); e.hasMoreElements();) {
+ if ( ((Long)(e.nextElement())).longValue() == inst.where) {
+ findTry = true;
+ break;
+ }
+ }
+ if (!findTry) {
+ TableLot.addElement(new Cover(CT_BLOCK, inst.where, inst.pc));
+ count++;
+ begseg = true;
+ }
+ }
+ }
+ switch (inst.opc) {
+ case opc_label:
+ begseg = false;
+ break;
+ case opc_ifeq:
+ case opc_ifne:
+ case opc_ifnull:
+ case opc_ifnonnull:
+ case opc_ifgt:
+ case opc_ifge:
+ case opc_iflt:
+ case opc_ifle:
+ case opc_if_icmpeq:
+ case opc_if_icmpne:
+ case opc_if_icmpgt:
+ case opc_if_icmpge:
+ case opc_if_icmplt:
+ case opc_if_icmple:
+ case opc_if_acmpeq:
+ case opc_if_acmpne: {
+ if ( inst.flagCondInverted ) {
+ TableLot.addElement(new Cover(CT_BRANCH_TRUE, inst.where, inst.pc));
+ TableLot.addElement(new Cover(CT_BRANCH_FALSE, inst.where, inst.pc));
+ } else {
+ TableLot.addElement(new Cover(CT_BRANCH_FALSE, inst.where, inst.pc));
+ TableLot.addElement(new Cover(CT_BRANCH_TRUE, inst.where, inst.pc));
+ }
+ count += 2;
+ begseg = false;
+ break;
+ }
+
+ case opc_goto: {
+ begseg = false;
+ break;
+ }
+
+ case opc_ret:
+ case opc_return:
+ case opc_ireturn:
+ case opc_lreturn:
+ case opc_freturn:
+ case opc_dreturn:
+ case opc_areturn:
+ case opc_athrow: {
+ break;
+ }
+
+ case opc_try: {
+ whereTry.addElement(new Long(inst.where));
+ begseg = false;
+ break;
+ }
+
+ case opc_tableswitch: {
+ SwitchData sw = (SwitchData)inst.value;
+ for (int i = sw.minValue; i <= sw.maxValue; i++) {
+ TableLot.addElement(new Cover(CT_CASE, sw.whereCase(new Integer(i)), inst.pc));
+ count++;
+ }
+ if (!sw.getDefault()) {
+ TableLot.addElement(new Cover(CT_SWITH_WO_DEF, inst.where, inst.pc));
+ count++;
+ } else {
+ TableLot.addElement(new Cover(CT_CASE, sw.whereCase("default"), inst.pc));
+ count++;
+ }
+ begseg = false;
+ break;
+ }
+ case opc_lookupswitch: {
+ SwitchData sw = (SwitchData)inst.value;
+ for (Enumeration e = sw.sortedKeys(); e.hasMoreElements() ; ) {
+ Integer v = (Integer)e.nextElement();
+ TableLot.addElement(new Cover(CT_CASE, sw.whereCase(v), inst.pc));
+ count++;
+ }
+ if (!sw.getDefault()) {
+ TableLot.addElement(new Cover(CT_SWITH_WO_DEF, inst.where, inst.pc));
+ count++;
+ } else {
+ TableLot.addElement(new Cover(CT_CASE, sw.whereCase("default"), inst.pc));
+ count++;
+ }
+ begseg = false;
+ break;
+ }
+ }
+ }
+ Cover Lot;
+ long ln, pos;
+
+ out.writeShort(count);
+ for (int i = 0; i < count; i++) {
+ Lot = (Cover)TableLot.elementAt(i);
+ ln = (Lot.Addr >> WHEREOFFSETBITS);
+ pos = (Lot.Addr << (64 - WHEREOFFSETBITS)) >> (64 - WHEREOFFSETBITS);
+ out.writeShort(Lot.NumCommand);
+ out.writeShort(Lot.Type);
+ out.writeInt((int)ln);
+ out.writeInt((int)pos);
+
+ if ( !(Lot.Type == CT_CASE && Lot.Addr == 0) ) {
+ JcovClassCountArray[Lot.Type]++;
+ }
+ }
+
+ }
+
+/*
+ * Increase count of methods for native methods
+ */
+
+public void addNativeToJcovTab(Environment env, ClassDefinition c) {
+ JcovClassCountArray[CT_METHOD]++;
+}
+
+/*
+ * Create class jcov element
+ */
+
+private String createClassJcovElement(Environment env, ClassDefinition c) {
+ String SourceClass = (Type.mangleInnerType((c.getClassDeclaration()).getName())).toString();
+ String ConvSourceClass;
+ String classJcovLine;
+
+ SourceClassList.addElement(SourceClass);
+ ConvSourceClass = SourceClass.replace('.', '/');
+ classJcovLine = JcovClassLine + ConvSourceClass;
+
+ classJcovLine = classJcovLine + " [";
+ String blank = "";
+
+ for (int i = 0; i < arrayModifiers.length; i++ ) {
+ if ((c.getModifiers() & arrayModifiers[i]) != 0) {
+ classJcovLine = classJcovLine + blank + opNames[arrayModifiersOpc[i]];
+ blank = " ";
+ }
+ }
+ classJcovLine = classJcovLine + "]";
+
+ return classJcovLine;
+}
+
+/*
+ * generate coverage data
+ */
+
+public void GenVecJCov(Environment env, ClassDefinition c, long Time) {
+ String SourceFile = ((SourceClass)c).getAbsoluteName();
+
+ TmpCovTable.addElement(createClassJcovElement(env, c));
+ TmpCovTable.addElement(JcovSrcfileLine + SourceFile);
+ TmpCovTable.addElement(JcovTimestampLine + Time);
+ TmpCovTable.addElement(JcovDataLine + "A"); // data format
+ TmpCovTable.addElement(JcovHeadingLine);
+
+ for (int i = CT_FIRST_KIND; i <= CT_LAST_KIND; i++) {
+ if (JcovClassCountArray[i] != 0) {
+ TmpCovTable.addElement(new String(i + "\t" + JcovClassCountArray[i]));
+ JcovClassCountArray[i] = 0;
+ }
+ }
+}
+
+
+/*
+ * generate file of coverage data
+ */
+
+public void GenJCov(Environment env) {
+
+ try {
+ File outFile = env.getcovFile();
+ if( outFile.exists()) {
+ DataInputStream JCovd = new DataInputStream(
+ new BufferedInputStream(
+ new FileInputStream(outFile)));
+ String CurrLine = null;
+ boolean first = true;
+ String Class;
+
+ CurrLine = JCovd.readLine();
+ if ((CurrLine != null) && CurrLine.startsWith(JcovMagicLine)) {
+ // this is a good Jcov file
+
+ while((CurrLine = JCovd.readLine()) != null ) {
+ if ( CurrLine.startsWith(JcovClassLine) ) {
+ first = true;
+ for(Enumeration e = SourceClassList.elements(); e.hasMoreElements();) {
+ String clsName = CurrLine.substring(JcovClassLine.length());
+ int idx = clsName.indexOf(' ');
+
+ if (idx != -1) {
+ clsName = clsName.substring(0, idx);
+ }
+ Class = (String)e.nextElement();
+ if ( Class.compareTo(clsName) == 0) {
+ first = false;
+ break;
+ }
+ }
+ }
+ if (first) // re-write old class
+ TmpCovTable.addElement(CurrLine);
+ }
+ }
+ JCovd.close();
+ }
+ PrintStream CovFile = new PrintStream(new DataOutputStream(new FileOutputStream(outFile)));
+ CovFile.println(JcovMagicLine);
+ for(Enumeration e = TmpCovTable.elements(); e.hasMoreElements();) {
+ CovFile.println(e.nextElement());
+ }
+ CovFile.close();
+ }
+ catch (FileNotFoundException e) {
+ System.out.println("ERROR: " + e);
+ }
+ catch (IOException e) {
+ System.out.println("ERROR: " + e);
+ }
+}
+// end JCOV
+
+
+ /**
+ * Write the linenumber table
+ */
+ public void writeLineNumberTable(Environment env, DataOutputStream out, ConstantPool tab) throws IOException {
+ long ln = -1;
+ int count = 0;
+
+ for (Instruction inst = first ; inst != null ; inst = inst.next) {
+ long n = (inst.where >> WHEREOFFSETBITS);
+ if ((n > 0) && (ln != n)) {
+ ln = n;
+ count++;
+ }
+ }
+
+ ln = -1;
+ out.writeShort(count);
+ for (Instruction inst = first ; inst != null ; inst = inst.next) {
+ long n = (inst.where >> WHEREOFFSETBITS);
+ if ((n > 0) && (ln != n)) {
+ ln = n;
+ out.writeShort(inst.pc);
+ out.writeShort((int)ln);
+ //System.out.println("pc = " + inst.pc + ", ln = " + ln);
+ }
+ }
+ }
+
+ /**
+ * Figure out when registers contain a legal value. This is done
+ * using a simple data flow algorithm. This information is later used
+ * to generate the local variable table.
+ */
+ void flowFields(Environment env, Label lbl, MemberDefinition locals[]) {
+ if (lbl.locals != null) {
+ // Been here before. Erase any conflicts.
+ MemberDefinition f[] = lbl.locals;
+ for (int i = 0 ; i < maxvar ; i++) {
+ if (f[i] != locals[i]) {
+ f[i] = null;
+ }
+ }
+ return;
+ }
+
+ // Remember the set of active registers at this point
+ lbl.locals = new MemberDefinition[maxvar];
+ System.arraycopy(locals, 0, lbl.locals, 0, maxvar);
+
+ MemberDefinition newlocals[] = new MemberDefinition[maxvar];
+ System.arraycopy(locals, 0, newlocals, 0, maxvar);
+ locals = newlocals;
+
+ for (Instruction inst = lbl.next ; inst != null ; inst = inst.next) {
+ switch (inst.opc) {
+ case opc_istore: case opc_istore_0: case opc_istore_1:
+ case opc_istore_2: case opc_istore_3:
+ case opc_fstore: case opc_fstore_0: case opc_fstore_1:
+ case opc_fstore_2: case opc_fstore_3:
+ case opc_astore: case opc_astore_0: case opc_astore_1:
+ case opc_astore_2: case opc_astore_3:
+ case opc_lstore: case opc_lstore_0: case opc_lstore_1:
+ case opc_lstore_2: case opc_lstore_3:
+ case opc_dstore: case opc_dstore_0: case opc_dstore_1:
+ case opc_dstore_2: case opc_dstore_3:
+ if (inst.value instanceof LocalVariable) {
+ LocalVariable v = (LocalVariable)inst.value;
+ locals[v.slot] = v.field;
+ }
+ break;
+
+ case opc_label:
+ flowFields(env, (Label)inst, locals);
+ return;
+
+ case opc_ifeq: case opc_ifne: case opc_ifgt:
+ case opc_ifge: case opc_iflt: case opc_ifle:
+ case opc_if_icmpeq: case opc_if_icmpne: case opc_if_icmpgt:
+ case opc_if_icmpge: case opc_if_icmplt: case opc_if_icmple:
+ case opc_if_acmpeq: case opc_if_acmpne:
+ case opc_ifnull: case opc_ifnonnull:
+ case opc_jsr:
+ flowFields(env, (Label)inst.value, locals);
+ break;
+
+ case opc_goto:
+ flowFields(env, (Label)inst.value, locals);
+ return;
+
+ case opc_return: case opc_ireturn: case opc_lreturn:
+ case opc_freturn: case opc_dreturn: case opc_areturn:
+ case opc_athrow: case opc_ret:
+ return;
+
+ case opc_tableswitch:
+ case opc_lookupswitch: {
+ SwitchData sw = (SwitchData)inst.value;
+ flowFields(env, sw.defaultLabel, locals);
+ for (Enumeration e = sw.tab.elements() ; e.hasMoreElements();) {
+ flowFields(env, (Label)e.nextElement(), locals);
+ }
+ return;
+ }
+
+ case opc_try: {
+ Vector catches = ((TryData)inst.value).catches;
+ for (Enumeration e = catches.elements(); e.hasMoreElements();) {
+ CatchData cd = (CatchData)e.nextElement();
+ flowFields(env, cd.getLabel(), locals);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Write the local variable table. The necessary constants have already been
+ * added to the constant table by the collect() method. The flowFields method
+ * is used to determine which variables are alive at each pc.
+ */
+ public void writeLocalVariableTable(Environment env, MemberDefinition field, DataOutputStream out, ConstantPool tab) throws IOException {
+ MemberDefinition locals[] = new MemberDefinition[maxvar];
+ int i = 0;
+
+ // Initialize arguments
+ if ((field != null) && (field.getArguments() != null)) {
+ int reg = 0;
+ Vector v = field.getArguments();
+ for (Enumeration e = v.elements(); e.hasMoreElements(); ) {
+ MemberDefinition f = ((MemberDefinition)e.nextElement());
+ locals[reg] = f;
+ reg += f.getType().stackSize();
+ }
+ }
+
+ flowFields(env, first, locals);
+ LocalVariableTable lvtab = new LocalVariableTable();
+
+ // Initialize arguments again
+ for (i = 0; i < maxvar; i++)
+ locals[i] = null;
+ if ((field != null) && (field.getArguments() != null)) {
+ int reg = 0;
+ Vector v = field.getArguments();
+ for (Enumeration e = v.elements(); e.hasMoreElements(); ) {
+ MemberDefinition f = ((MemberDefinition)e.nextElement());
+ locals[reg] = f;
+ lvtab.define(f, reg, 0, maxpc);
+ reg += f.getType().stackSize();
+ }
+ }
+
+ int pcs[] = new int[maxvar];
+
+ for (Instruction inst = first ; inst != null ; inst = inst.next) {
+ switch (inst.opc) {
+ case opc_istore: case opc_istore_0: case opc_istore_1:
+ case opc_istore_2: case opc_istore_3: case opc_fstore:
+ case opc_fstore_0: case opc_fstore_1: case opc_fstore_2:
+ case opc_fstore_3:
+ case opc_astore: case opc_astore_0: case opc_astore_1:
+ case opc_astore_2: case opc_astore_3:
+ case opc_lstore: case opc_lstore_0: case opc_lstore_1:
+ case opc_lstore_2: case opc_lstore_3:
+ case opc_dstore: case opc_dstore_0: case opc_dstore_1:
+ case opc_dstore_2: case opc_dstore_3:
+ if (inst.value instanceof LocalVariable) {
+ LocalVariable v = (LocalVariable)inst.value;
+ int pc = (inst.next != null) ? inst.next.pc : inst.pc;
+ if (locals[v.slot] != null) {
+ lvtab.define(locals[v.slot], v.slot, pcs[v.slot], pc);
+ }
+ pcs[v.slot] = pc;
+ locals[v.slot] = v.field;
+ }
+ break;
+
+ case opc_label: {
+ // flush previous labels
+ for (i = 0 ; i < maxvar ; i++) {
+ if (locals[i] != null) {
+ lvtab.define(locals[i], i, pcs[i], inst.pc);
+ }
+ }
+ // init new labels
+ int pc = inst.pc;
+ MemberDefinition[] labelLocals = ((Label)inst).locals;
+ if (labelLocals == null) { // unreachable code??
+ for (i = 0; i < maxvar; i++)
+ locals[i] = null;
+ } else {
+ System.arraycopy(labelLocals, 0, locals, 0, maxvar);
+ }
+ for (i = 0 ; i < maxvar ; i++) {
+ pcs[i] = pc;
+ }
+ break;
+ }
+ }
+ }
+
+ // flush remaining labels
+ for (i = 0 ; i < maxvar ; i++) {
+ if (locals[i] != null) {
+ lvtab.define(locals[i], i, pcs[i], maxpc);
+ }
+ }
+
+ // write the local variable table
+ lvtab.write(env, out, tab);
+ }
+
+ /**
+ * Return true if empty
+ */
+ public boolean empty() {
+ return first == last;
+ }
+
+ /**
+ * Print the byte codes
+ */
+ public void listing(PrintStream out) {
+ out.println("-- listing --");
+ for (Instruction inst = first ; inst != null ; inst = inst.next) {
+ out.println(inst.toString());
+ }
+ }
+}
+
Added: trunk/core/src/openjdk/sun/sun/tools/asm/CatchData.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/tools/asm/CatchData.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/tools/asm/CatchData.java 2007-06-10 08:42:12 UTC (rev 3232)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.tools.asm;
+
+import sun.tools.java.*;
+import java.util.Hashtable;
+
+/**
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+public final
+class CatchData {
+ Object type;
+ Label label;
+
+ /**
+ * Constructor
+ */
+ CatchData(Object type) {
+ this.type = type;
+ this.label = new Label();
+ }
+
+ /**
+ * Get the label
+ */
+ public Label getLabel() {
+ return label;
+ }
+
+ /**
+ * Get the clazz
+ */
+ public Object getType() {
+ return type;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/tools/asm/ClassConstantData.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/tools/asm/ClassConstantData.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/tools/asm/ClassConstantData.java 2007-06-10 08:42:12 UTC (rev 3232)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.tools.asm;
+
+import sun.tools.java.*;
+import java.io.IOException;
+import java.io.DataOutputStream;
+
+/**
+ * This is a class constant pool item.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+final
+class ClassConstantData extends ConstantPoolData {
+ String name;
+
+ /**
+ * Constructor
+ */
+
+ ClassConstantData(ConstantPool tab, ClassDeclaration clazz) {
+ String sig = clazz.getType().getTypeSignature();
+ // sig is like "Lfoo/bar;", name is like "foo/bar".
+ // We assume SIG_CLASS and SIG_ENDCLASS are 1 char each.
+ name = sig.substring(1, sig.length()-1);
+ tab.put(name);
+ }
+
+ // REMIND: this case should eventually go away.
+ ClassConstantData(ConstantPool tab, Type t) {
+ name = t.getTypeSignature();
+ tab.put(name);
+ }
+
+ /**
+ * Write the constant to the output stream
+ */
+ void write(Environment env, DataOutputStream out, ConstantPool tab) throws IOException {
+ out.writeByte(CONSTANT_CLASS);
+ out.writeShort(tab.index(name));
+ }
+
+ /**
+ * Return the order of the constant
+ */
+ int order() {
+ return 1;
+ }
+
+ public String toString() {
+ return "ClassConstantData[" + name + "]";
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/tools/asm/ConstantPool.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/tools/asm/ConstantPool.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/tools/asm/ConstantPool.java 2007-06-10 08:42:12 UTC (rev 3232)
@@ -0,0 +1,177 @@
+/*
+ * Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.tools.asm;
+
+import sun.tools.java.*;
+import sun.tools.tree.StringExpression;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+import java.io.IOException;
+import java.io.DataOutputStream;
+
+/**
+ * A table of constants
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+public final
+class ConstantPool implements RuntimeConstants {
+ Hashtable hash = new Hashtable(101);
+
+ /**
+ * Find an entry, may return 0
+ */
+ public int index(Object obj) {
+ return ((ConstantPoolData)hash.get(obj)).index;
+ }
+
+ /**
+ * Add an entry
+ */
+ public void put(Object obj) {
+ ConstantPoolData data = (ConstantPoolData)hash.get(obj);
+ if (data == null) {
+ if (obj instanceof String) {
+ data = new StringConstantData(this, (String)obj);
+ } else if (obj instanceof StringExpression) {
+ data = new StringExpressionConstantData(this, (StringExpression)obj);
+ } else if (obj instanceof ClassDeclaration) {
+ data = new ClassConstantData(this, (ClassDeclaration)obj);
+ } else if (obj instanceof Type) {
+ data = new ClassConstantData(this, (Type)obj);
+ } else if (obj instanceof MemberDefinition) {
+ data = new FieldConstantData(this, (MemberDefinition)obj);
+ } else if (obj instanceof NameAndTypeData) {
+ data = new NameAndTypeConstantData(this, (NameAndTypeData)obj);
+ } else if (obj instanceof Number) {
+ data = new NumberConstantData(this, (Number)obj);
+ }
+ hash.put(obj, data);
+ }
+ }
+
+ /**
+ * Write to output
+ */
+ public void write(Environment env, DataOutputStream out) throws IOException {
+ ConstantPoolData list[] = new ConstantPoolData[hash.size()];
+ String keys[] = new String[list.length];
+ int index = 1, count = 0;
+
+ // Make a list of all the constant pool items
+ for (int n = 0 ; n < 5 ; n++) {
+ int first = count;
+ for (Enumeration e = hash.elements() ; e.hasMoreElements() ;) {
+ ConstantPoolData data = (ConstantPoolData)e.nextElement();
+ if (data.order() == n) {
+ keys[count] = sortKey(data);
+ list[count++] = data;
+ }
+ }
+ xsort(list, keys, first, count-1);
+ }
+
+ // Assign an index to each constant pool item
+ for (int n = 0 ; n < list.length ; n++) {
+ ConstantPoolData data = list[n];
+ data.index = index;
+ index += data.width();
+ }
+
+ // Write length
+ out.writeShort(index);
+
+ // Write each constant pool item
+ for (int n = 0 ; n < count ; n++) {
+ list[n].write(env, out, this);
+ }
+ }
+
+ private
+ static String sortKey(ConstantPoolData f) {
+ if (f instanceof NumberConstantData) {
+ Number num = ((NumberConstantData)f).num;
+ String str = num.toString();
+ int key = 3;
+ if (num instanceof Integer) key = 0;
+ else if (num instanceof Float) key = 1;
+ else if (num instanceof Long) key = 2;
+ return "\0" + (char)(str.length() + key<<8) + str;
+ }
+ if (f instanceof StringExpressionConstantData)
+ return (String)((StringExpressionConstantData)f).str.getValue();
+ if (f instanceof FieldConstantData) {
+ MemberDefinition fd = ((FieldConstantData)f).field;
+ return fd.getName()+" "+fd.getType().getTypeSignature()
+ +" "+fd.getClassDeclaration().getName();
+ }
+ if (f instanceof NameAndTypeConstantData)
+ return ((NameAndTypeConstantData)f).name+
+ " "+((NameAndTypeConstantData)f).type;
+ if (f instanceof ClassConstantData)
+ return ((ClassConstantData)f).name;
+ return ((StringConstantData)f).str;
+ }
+
+ /**
+ * Quick sort an array of pool entries and a corresponding array of Strings
+ * that are the sort keys for the field.
+ */
+ private
+ static void xsort(ConstantPoolData ff[], String ss[], int left, int right) {
+ if (left >= right)
+ return;
+ String pivot = ss[left];
+ int l = left;
+ int r = right;
+ while (l < r) {
+ while (l <= right && ss[l].compareTo(pivot) <= 0)
+ l++;
+ while (r >= left && ss[r].compareTo(pivot) > 0)
+ r--;
+ if (l < r) {
+ // swap items at l and at r
+ ConstantPoolData def = ff[l];
+ String name = ss[l];
+ ff[l] = ff[r]; ff[r] = def;
+ ss[l] = ss[r]; ss[r] = name;
+ }
+ }
+ int middle = r;
+ // swap left and middle
+ ConstantPoolData def = ff[left];
+ String name = ss[left];
+ ff[left] = ff[middle]; ff[middle] = def;
+ ss[left] = ss[middle]; ss[middle] = name;
+ xsort(ff, ss, left, middle-1);
+ xsort(ff, ss, middle + 1, right);
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/tools/asm/ConstantPoolData.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/tools/asm/ConstantPoolData.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/tools/asm/ConstantPoolData.java 2007-06-10 08:42:12 UTC (rev 3232)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.tools.asm;
+
+import sun.tools.java.*;
+import java.io.IOException;
+import java.io.DataOutputStream;
+
+/**
+ * Base constant data class. Every constant pool data item
+ * is derived from this class.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+
+abstract class ConstantPoolData implements RuntimeConstants {
+ int index;
+
+ /**
+ * Write the constant to the output stream
+ */
+ abstract void write(Environment env, DataOutputStream out, ConstantPool tab) throws IOException;
+
+ /**
+ * Return the order of the constant
+ */
+ int order() {
+ return 0;
+ }
+
+ /**
+ * Return the number of entries that it takes up in the constant pool
+ */
+ int width() {
+ return 1;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/tools/asm/Cover.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/tools/asm/Cover.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/tools/asm/Cover.java 2007-06-10 08:42:12 UTC (rev 3232)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.tools.asm;
+
+/**
+ * WARNING: The contents of this source file are not part of any
+ * supported API. Code that depends on them does so at its own ri...
[truncated message content] |
|
From: <kon...@us...> - 2007-05-20 00:29:22
|
Revision: 3231
http://jnode.svn.sourceforge.net/jnode/?rev=3231&view=rev
Author: konkubinaten
Date: 2007-05-19 17:29:08 -0700 (Sat, 19 May 2007)
Log Message:
-----------
+ added the sources for the current mauve classes
~ updated mauve classes with a JNode specific modified list of testlets
Modified Paths:
--------------
trunk/core/lib/mauve.jar
Added Paths:
-----------
trunk/core/lib/mauve-src.jar
Added: trunk/core/lib/mauve-src.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/lib/mauve-src.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/core/lib/mauve.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kon...@us...> - 2007-05-20 00:26:55
|
Revision: 3230
http://jnode.svn.sourceforge.net/jnode/?rev=3230&view=rev
Author: konkubinaten
Date: 2007-05-19 17:26:24 -0700 (Sat, 19 May 2007)
Log Message:
-----------
~ more silly sanity checks to prevent unpredictable errors causing a real panic
Modified Paths:
--------------
trunk/core/src/test/org/jnode/test/mauve/HTMLGenerator.java
trunk/core/src/test/org/jnode/test/mauve/MauveTestCommand.java
Modified: trunk/core/src/test/org/jnode/test/mauve/HTMLGenerator.java
===================================================================
--- trunk/core/src/test/org/jnode/test/mauve/HTMLGenerator.java 2007-05-18 20:49:59 UTC (rev 3229)
+++ trunk/core/src/test/org/jnode/test/mauve/HTMLGenerator.java 2007-05-20 00:26:24 UTC (rev 3230)
@@ -123,7 +123,17 @@
writer.println("</tr>");
// (2) generate an HTML page for the test and subfiles
// for the tests
- HTMLGenerator.createPackageReport(packageResult, rootDirectory);
+ try {
+ HTMLGenerator.createPackageReport(packageResult, rootDirectory);
+ } catch (Exception e) {
+ String temp = packageResult.getName().replace('.', '/');
+ System.err.println("Couldn't create package report for " + temp);
+ File tempDir = new File(rootDirectory, packageName);
+ tempDir.mkdirs();
+ File tempFile = new File(tempDir, "package_index.html");
+ tempFile.createNewFile();
+ }
+ System.gc();
}
writer.println("</table>");
writer.println("</td>");
@@ -366,7 +376,13 @@
check.getPassed() + "</td><td bgcolor=\"white\">" + check.getExpected() +
"</td><td bgcolor=\"white\">" + check.getActual() + "</td>");
if (!check.getPassed()) {
- createLogReport(check, className, testResult.getName(), classDirectory);
+ try {
+ createLogReport(check, className, testResult.getName(), classDirectory);
+ } catch (Exception e) {
+ System.err.println("Couldn't write report for class " + className);
+ File temp = new File(classDirectory, testResult.getName() + "_log.html");
+ temp.createNewFile();
+ }
}
writer.println("</td>");
writer.println("</tr>");
@@ -393,6 +409,7 @@
* @param classDirectory the class directory.
*/
public static void createLogReport(CheckResult checkResult, String className, String testName, File classDirectory) throws IOException {
+
// write basic HTML for test
File logFile = new File(classDirectory, testName + "_log.html");
OutputStream out = new BufferedOutputStream(new FileOutputStream(logFile));
Modified: trunk/core/src/test/org/jnode/test/mauve/MauveTestCommand.java
===================================================================
--- trunk/core/src/test/org/jnode/test/mauve/MauveTestCommand.java 2007-05-18 20:49:59 UTC (rev 3229)
+++ trunk/core/src/test/org/jnode/test/mauve/MauveTestCommand.java 2007-05-20 00:26:24 UTC (rev 3230)
@@ -58,6 +58,8 @@
private RunResult result;
+ private static int counter = 0;
+
/**
* runs tests
*
@@ -170,10 +172,13 @@
System.err.println("Could not load test: " + line);
result.addMissingTest(line);
}
-
- System.out.println("Test done, now running gc");
- System.gc();
-
+
+ counter++;
+ System.out.println("Done " + counter + " tests so far.");
+ if ((counter % 20) == 0) {
+ System.out.println("next 20 tests done, running gc...");
+ System.gc();
+ }
}
} catch (FileNotFoundException e) {
throw new IllegalArgumentException(e.getMessage());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-18 20:50:01
|
Revision: 3229
http://jnode.svn.sourceforge.net/jnode/?rev=3229&view=rev
Author: lsantha
Date: 2007-05-18 13:49:59 -0700 (Fri, 18 May 2007)
Log Message:
-----------
Added standard scripting support (included beanshell and rhino - javascript).
Modified Paths:
--------------
trunk/all/conf/default-plugin-list.xml
Modified: trunk/all/conf/default-plugin-list.xml
===================================================================
--- trunk/all/conf/default-plugin-list.xml 2007-05-18 20:31:26 UTC (rev 3228)
+++ trunk/all/conf/default-plugin-list.xml 2007-05-18 20:49:59 UTC (rev 3229)
@@ -156,6 +156,7 @@
<plugin id="org.jnode.shell.command.plugin"/>
<plugin id="org.jnode.shell.command.system"/>
<plugin id="org.beanshell"/>
+ <plugin id="js"/>
<plugin id="org.jnode.system.repository"/>
<plugin id="org.jnode.test.core"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-18 20:31:29
|
Revision: 3228
http://jnode.svn.sourceforge.net/jnode/?rev=3228&view=rev
Author: lsantha
Date: 2007-05-18 13:31:26 -0700 (Fri, 18 May 2007)
Log Message:
-----------
Added standard scripting support (included beanshell and rhino - javascript).
Modified Paths:
--------------
trunk/shell/descriptors/js.xml
Modified: trunk/shell/descriptors/js.xml
===================================================================
--- trunk/shell/descriptors/js.xml 2007-05-18 20:27:30 UTC (rev 3227)
+++ trunk/shell/descriptors/js.xml 2007-05-18 20:31:26 UTC (rev 3228)
@@ -13,8 +13,12 @@
<export name="*"/>
</library>
</runtime>
-
- <extension point="org.jnode.security.permissions">
+
+ <extension point="org.jnode.shell.aliases">
+ <alias name="js" class="org.mozilla.javascript.tools.shell.Main"/>
+ </extension>
+
+ <extension point="org.jnode.security.permissions">
<permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
<permission class="java.lang.RuntimePermission" name="setSecurityManager" actions="*" />
<permission class="java.lang.RuntimePermission" name="createClassLoader" actions="*" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-18 20:27:31
|
Revision: 3227
http://jnode.svn.sourceforge.net/jnode/?rev=3227&view=rev
Author: lsantha
Date: 2007-05-18 13:27:30 -0700 (Fri, 18 May 2007)
Log Message:
-----------
Added standard scripting support (included beanshell and rhino - javascript).
Modified Paths:
--------------
trunk/all/conf/default-plugin-list.xml
Modified: trunk/all/conf/default-plugin-list.xml
===================================================================
--- trunk/all/conf/default-plugin-list.xml 2007-05-18 20:26:17 UTC (rev 3226)
+++ trunk/all/conf/default-plugin-list.xml 2007-05-18 20:27:30 UTC (rev 3227)
@@ -82,6 +82,7 @@
<plugin id="org.jnode.driver.net.rtl8139"/>
<plugin id="org.jnode.driver.net.bcm570x"/>
<plugin id="org.jnode.driver.net.wireless"/>
+ <plugin id="org.jnode.driver.net.via_rhine"/>
<plugin id="org.jnode.driver.ps2"/>
<plugin id="org.jnode.driver.serial"/>
<plugin id="org.jnode.driver.system.acpi"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-18 20:26:18
|
Revision: 3226
http://jnode.svn.sourceforge.net/jnode/?rev=3226&view=rev
Author: lsantha
Date: 2007-05-18 13:26:17 -0700 (Fri, 18 May 2007)
Log Message:
-----------
Added standard scripting support (included beanshell and rhino - javascript).
Modified Paths:
--------------
trunk/all/build.xml
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2007-05-18 20:24:37 UTC (rev 3225)
+++ trunk/all/build.xml 2007-05-18 20:26:17 UTC (rev 3226)
@@ -63,7 +63,8 @@
<property name="gnu-crypto.jar" value="${root.dir}/core/lib/gnu-crypto.jar"/>
<property name="javax-crypto.jar" value="${root.dir}/core/lib/javax-crypto.jar"/>
<!-- property name="javax-security.jar" value="${root.dir}/core/lib/javax-security.jar" / -->
- <property name="beanshell.jar" value="${root.dir}/shell/lib/bsh-2.0b4.jar"/>
+ <property name="beanshell.jar" value="${root.dir}/shell/lib/bsh-2.0b5.jar"/>
+ <property name="js.jar" value="${root.dir}/shell/lib/rhino1.6r5-jsr223.jar"/>
<!-- libraries needed to check plugin dependencies -->
<property name="bcel-5.1.jar" value="${root.dir}/builder/lib/bcel-5.1.jar" />
@@ -97,6 +98,7 @@
<pathelement location="${javax-crypto.jar}"/>
<pathelement location="${basedir}/conf"/>
<pathelement location="${beanshell.jar}"/>
+ <pathelement location="${js.jar}"/>
<pathelement location="${jcfe.jar}"/>
<pathelement location="${jfunc.jar}"/>
</path>
@@ -189,6 +191,7 @@
<libalias name="javax-crypto.jar" alias="${javax-crypto.jar}"/>
<libalias name="log4j.jar" alias="${log4j.jar}"/>
<libalias name="beanshell.jar" alias="${beanshell.jar}"/>
+ <libalias name="js.jar" alias="${js.jar}"/>
<libalias name="lw.jar" alias="${lw.jar}"/>
<libalias name="thinlet.jar" alias="${thinlet.jar}"/>
@@ -425,6 +428,7 @@
</target>
<!-- Backup CVS files -->
+ <!-- TODO create replacement SVN task
<target name="backup">
<mkdir dir="${backup.dir}"/>
<tstamp>
@@ -432,6 +436,7 @@
</tstamp>
<get src="http://cvs.sourceforge.net/cvstarballs/jnode-cvsroot.tar.bz2" dest="${backup.dir}/jnode-cvsroot-${date}.tar.bz2" usetimestamp="true" verbose="true"/>
</target>
+ -->
<!-- Compare classpath version of jnode with real classpath version -->
<target name="cp-compare" depends="assemble">
@@ -663,7 +668,8 @@
</target>
<!-- Create a patch -->
- <target name="create-patch">
+ <!-- TODO create replacement SVN task
+ <target name="create-patch">
<property name="patch.file" value="${root.dir}/patch.txt"/>
<echo>Creating patch in ${patch.file}</echo>
<cvs output="${patch.file}" dest="${root.dir}">
@@ -672,4 +678,5 @@
</commandline>
</cvs>
</target>
+ -->
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-18 20:24:43
|
Revision: 3225
http://jnode.svn.sourceforge.net/jnode/?rev=3225&view=rev
Author: lsantha
Date: 2007-05-18 13:24:37 -0700 (Fri, 18 May 2007)
Log Message:
-----------
Added standard scripting support (included beanshell and rhino - javascript).
Added Paths:
-----------
trunk/shell/descriptors/js.xml
Added: trunk/shell/descriptors/js.xml
===================================================================
--- trunk/shell/descriptors/js.xml (rev 0)
+++ trunk/shell/descriptors/js.xml 2007-05-18 20:24:37 UTC (rev 3225)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="js"
+ name="Rhino classes"
+ version="1.0"
+ provider-name="mozilla.org"
+ provider-url="http://www.mozilla.org/rhino/"
+ license-name="mpl">
+
+ <runtime>
+ <library name="js.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+
+ <extension point="org.jnode.security.permissions">
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="java.lang.RuntimePermission" name="setSecurityManager" actions="*" />
+ <permission class="java.lang.RuntimePermission" name="createClassLoader" actions="*" />
+ <permission class="java.lang.RuntimePermission" name="setIO" actions="*" />
+ <permission class="java.lang.RuntimePermission" name="exitVM" actions="*" />
+ <permission class="org.jnode.security.JNodePermission" name="getVmClass" actions="*" />
+ <permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
+ </extension>
+</plugin>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-18 20:20:09
|
Revision: 3224
http://jnode.svn.sourceforge.net/jnode/?rev=3224&view=rev
Author: lsantha
Date: 2007-05-18 13:20:07 -0700 (Fri, 18 May 2007)
Log Message:
-----------
Added standard scripting support (included beanshell and rhino - javascript).
Added Paths:
-----------
trunk/shell/lib/bsh-2.0b5.jar
trunk/shell/lib/rhino1.6r5-jsr223.jar
Removed Paths:
-------------
trunk/shell/lib/bsh-2.0b4.jar
Deleted: trunk/shell/lib/bsh-2.0b4.jar
===================================================================
(Binary files differ)
Added: trunk/shell/lib/bsh-2.0b5.jar
===================================================================
(Binary files differ)
Property changes on: trunk/shell/lib/bsh-2.0b5.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/shell/lib/rhino1.6r5-jsr223.jar
===================================================================
(Binary files differ)
Property changes on: trunk/shell/lib/rhino1.6r5-jsr223.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-18 20:01:27
|
Revision: 3223
http://jnode.svn.sourceforge.net/jnode/?rev=3223&view=rev
Author: lsantha
Date: 2007-05-18 13:01:25 -0700 (Fri, 18 May 2007)
Log Message:
-----------
Added standard scripting support.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.ext.core.xml
Modified: trunk/core/descriptors/org.classpath.ext.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.core.xml 2007-05-17 20:41:04 UTC (rev 3222)
+++ trunk/core/descriptors/org.classpath.ext.core.xml 2007-05-18 20:01:25 UTC (rev 3223)
@@ -77,9 +77,14 @@
<export name="javax.sound.sampled.*"/>
<export name="javax.sound.sampled.spi.*"/>
-
+
+ <export name="javax.script.*"/>
+
+ <export name="sun.security.*"/>
+ <export name="sun.security.util.*"/>
+
<export name="sun.reflect.*"/>
- <export name="sun.reflect.annotation.*"/>
+ <export name="sun.reflect.annotation.*"/>
<export name="sun.reflect.misc.*"/>
</library>
</runtime>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-17 20:41:06
|
Revision: 3222
http://jnode.svn.sourceforge.net/jnode/?rev=3222&view=rev
Author: lsantha
Date: 2007-05-17 13:41:04 -0700 (Thu, 17 May 2007)
Log Message:
-----------
Openjdk patches.
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/
trunk/core/src/openjdk/javax/javax/script/
trunk/core/src/openjdk/javax/javax/script/AbstractScriptEngine.java
trunk/core/src/openjdk/javax/javax/script/Bindings.java
trunk/core/src/openjdk/javax/javax/script/Compilable.java
trunk/core/src/openjdk/javax/javax/script/CompiledScript.java
trunk/core/src/openjdk/javax/javax/script/Invocable.java
trunk/core/src/openjdk/javax/javax/script/ScriptContext.java
trunk/core/src/openjdk/javax/javax/script/ScriptEngine.java
trunk/core/src/openjdk/javax/javax/script/ScriptEngineFactory.java
trunk/core/src/openjdk/javax/javax/script/ScriptEngineManager.java
trunk/core/src/openjdk/javax/javax/script/ScriptException.java
trunk/core/src/openjdk/javax/javax/script/SimpleBindings.java
trunk/core/src/openjdk/javax/javax/script/SimpleScriptContext.java
trunk/core/src/openjdk/javax/javax/script/package.html
Added: trunk/core/src/openjdk/javax/javax/script/AbstractScriptEngine.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/script/AbstractScriptEngine.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/script/AbstractScriptEngine.java 2007-05-17 20:41:04 UTC (rev 3222)
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.script;
+import java.io.Reader;
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * Provides a standard implementation for several of the variants of the <code>eval</code>
+ * method.
+ * <br><br>
+ * <code><b>eval(Reader)</b></code><p><code><b>eval(String)</b></code><p>
+ * <code><b>eval(String, Bindings)</b></code><p><code><b>eval(Reader, Bindings)</b></code>
+ * <br><br> are implemented using the abstract methods
+ * <br><br>
+ * <code><b>eval(Reader,ScriptContext)</b></code> or
+ * <code><b>eval(String, ScriptContext)</b></code>
+ * <br><br>
+ * with a <code>SimpleScriptContext</code>.
+ * <br><br>
+ * A <code>SimpleScriptContext</code> is used as the default <code>ScriptContext</code>
+ * of the <code>AbstractScriptEngine</code>..
+ *
+ * @author Mike Grogan
+ * @version 1.0
+ * @since 1.6
+ */
+public abstract class AbstractScriptEngine implements ScriptEngine {
+
+ /**
+ * The default <code>ScriptContext</code> of this <code>AbstractScriptEngine</code>.
+ */
+
+ protected ScriptContext context;
+
+ /**
+ * Creates a new instance of AbstractScriptEngine using a <code>SimpleScriptContext</code>
+ * as its default <code>ScriptContext</code>.
+ */
+ public AbstractScriptEngine() {
+
+ context = new SimpleScriptContext();
+
+ }
+
+ /**
+ * Creates a new instance using the specified <code>Bindings</code> as the
+ * <code>ENGINE_SCOPE</code> <code>Bindings</code> in the protected <code>context</code> field.
+ *
+ * @param n The specified <code>Bindings</code>.
+ * @throws NullPointerException if n is null.
+ */
+ public AbstractScriptEngine(Bindings n) {
+
+ this();
+ if (n == null) {
+ throw new NullPointerException("n is null");
+ }
+ context.setBindings(n, ScriptContext.ENGINE_SCOPE);
+ }
+
+ /**
+ * Sets the value of the protected <code>context</code> field to the specified
+ * <code>ScriptContext</code>.
+ *
+ * @param ctxt The specified <code>ScriptContext</code>.
+ * @throws NullPointerException if ctxt is null.
+ */
+ public void setContext(ScriptContext ctxt) {
+ if (ctxt == null) {
+ throw new NullPointerException("null context");
+ }
+ context = ctxt;
+ }
+
+ /**
+ * Returns the value of the protected <code>context</code> field.
+ *
+ * @return The value of the protected <code>context</code> field.
+ */
+ public ScriptContext getContext() {
+ return context;
+ }
+
+ /**
+ * Returns the <code>Bindings</code> with the specified scope value in
+ * the protected <code>context</code> field.
+ *
+ * @param scope The specified scope
+ *
+ * @return The corresponding <code>Bindings</code>.
+ *
+ * @throws IllegalArgumentException if the value of scope is
+ * invalid for the type the protected <code>context</code> field.
+ */
+ public Bindings getBindings(int scope) {
+
+ if (scope == ScriptContext.GLOBAL_SCOPE) {
+ return context.getBindings(ScriptContext.GLOBAL_SCOPE);
+ } else if (scope == ScriptContext.ENGINE_SCOPE) {
+ return context.getBindings(ScriptContext.ENGINE_SCOPE);
+ } else {
+ throw new IllegalArgumentException("Invalid scope value.");
+ }
+ }
+
+ /**
+ * Sets the <code>Bindings</code> with the corresponding scope value in the
+ * <code>context</code> field.
+ *
+ * @param bindings The specified <code>Bindings</code>.
+ * @param scope The specified scope.
+ *
+ * @throws IllegalArgumentException if the value of scope is
+ * invalid for the type the <code>context</code> field.
+ * @throws NullPointerException if the bindings is null and the scope is
+ * <code>ScriptContext.ENGINE_SCOPE</code>
+ */
+ public void setBindings(Bindings bindings, int scope) {
+
+ if (scope == ScriptContext.GLOBAL_SCOPE) {
+ context.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);;
+ } else if (scope == ScriptContext.ENGINE_SCOPE) {
+ context.setBindings(bindings, ScriptContext.ENGINE_SCOPE);;
+ } else {
+ throw new IllegalArgumentException("Invalid scope value.");
+ }
+ }
+
+ /**
+ * Sets the specified value with the specified key in the <code>ENGINE_SCOPE</code>
+ * <code>Bindings</code> of the protected <code>context</code> field.
+ *
+ * @param key The specified key.
+ * @param value The specified value.
+ *
+ * @throws NullPointerException if key is null.
+ * @throws IllegalArgumentException if key is empty.
+ */
+ public void put(String key, Object value) {
+
+ Bindings nn = getBindings(ScriptContext.ENGINE_SCOPE);
+ if (nn != null) {
+ nn.put(key, value);
+ }
+
+ }
+
+ /**
+ * Gets the value for the specified key in the <code>ENGINE_SCOPE</code> of the
+ * protected <code>context</code> field.
+ *
+ * @return The value for the specified key.
+ *
+ * @throws NullPointerException if key is null.
+ * @throws IllegalArgumentException if key is empty.
+ */
+ public Object get(String key) {
+
+ Bindings nn = getBindings(ScriptContext.ENGINE_SCOPE);
+ if (nn != null) {
+ return nn.get(key);
+ }
+
+ return null;
+ }
+
+
+ /**
+ * <code>eval(Reader, Bindings)</code> calls the abstract
+ * <code>eval(Reader, ScriptContext)</code> method, passing it a <code>ScriptContext</code>
+ * whose Reader, Writers and Bindings for scopes other that <code>ENGINE_SCOPE</code>
+ * are identical to those members of the protected <code>context</code> field. The specified
+ * <code>Bindings</code> is used instead of the <code>ENGINE_SCOPE</code>
+ *
+ * <code>Bindings</code> of the <code>context</code> field.
+ *
+ * @param reader A <code>Reader</code> containing the source of the script.
+ * @param bindings A <code>Bindings</code> to use for the <code>ENGINE_SCOPE</code>
+ * while the script executes.
+ *
+ * @return The return value from <code>eval(Reader, ScriptContext)</code>
+ * @throws ScriptException if an error occurs in script.
+ * @throws NullPointerException if any of the parameters is null.
+ */
+ public Object eval(Reader reader, Bindings bindings ) throws ScriptException {
+
+ ScriptContext ctxt = getScriptContext(bindings);
+
+ return eval(reader, ctxt);
+ }
+
+
+ /**
+ * Same as <code>eval(Reader, Bindings)</code> except that the abstract
+ * <code>eval(String, ScriptContext)</code> is used.
+ *
+ * @param script A <code>String</code> containing the source of the script.
+ *
+ * @param bindings A <code>Bindings</code> to use as the <code>ENGINE_SCOPE</code>
+ * while the script executes.
+ *
+ * @return The return value from <code>eval(String, ScriptContext)</code>
+ * @throws ScriptException if an error occurs in script.
+ * @throws NullPointerException if any of the parameters is null.
+ */
+ public Object eval(String script, Bindings bindings) throws ScriptException {
+
+ ScriptContext ctxt = getScriptContext(bindings);
+
+ return eval(script , ctxt);
+ }
+
+ /**
+ * <code>eval(Reader)</code> calls the abstract
+ * <code>eval(Reader, ScriptContext)</code> passing the value of the <code>context</code>
+ * field.
+ *
+ * @param reader A <code>Reader</code> containing the source of the script.
+ * @return The return value from <code>eval(Reader, ScriptContext)</code>
+ * @throws ScriptException if an error occurs in script.
+ * @throws NullPointerException if any of the parameters is null.
+ */
+ public Object eval(Reader reader) throws ScriptException {
+
+
+ return eval(reader, context);
+ }
+
+ /**
+ * Same as <code>eval(Reader)</code> except that the abstract
+ * <code>eval(String, ScriptContext)</code> is used.
+ *
+ * @param script A <code>String</code> containing the source of the script.
+ * @return The return value from <code>eval(String, ScriptContext)</code>
+ * @throws ScriptException if an error occurrs in script.
+ * @throws NullPointerException if any of the parameters is null.
+ */
+ public Object eval(String script) throws ScriptException {
+
+
+ return eval(script, context);
+ }
+
+ /**
+ * Returns a <code>SimpleScriptContext</code>. The <code>SimpleScriptContext</code>:
+ *<br><br>
+ * <ul>
+ * <li>Uses the specified <code>Bindings</code> for its <code>ENGINE_SCOPE</code>
+ * </li>
+ * <li>Uses the <code>Bindings</code> returned by the abstract <code>getGlobalScope</code>
+ * method as its <code>GLOBAL_SCOPE</code>
+ * </li>
+ * <li>Uses the Reader and Writer in the default <code>ScriptContext</code> of this
+ * <code>ScriptEngine</code>
+ * </li>
+ * </ul>
+ * <br><br>
+ * A <code>SimpleScriptContext</code> returned by this method is used to implement eval methods
+ * using the abstract <code>eval(Reader,Bindings)</code> and <code>eval(String,Bindings)</code>
+ * versions.
+ *
+ * @param nn Bindings to use for the <code>ENGINE_SCOPE</code>
+ * @return The <code>SimpleScriptContext</code>
+ */
+ protected ScriptContext getScriptContext(Bindings nn) {
+
+ SimpleScriptContext ctxt = new SimpleScriptContext();
+ Bindings gs = getBindings(ScriptContext.GLOBAL_SCOPE);
+
+ if (gs != null) {
+ ctxt.setBindings(gs, ScriptContext.GLOBAL_SCOPE);
+ }
+
+ if (nn != null) {
+ ctxt.setBindings(nn,
+ ScriptContext.ENGINE_SCOPE);
+ } else {
+ throw new NullPointerException("Engine scope Bindings may not be null.");
+ }
+
+ ctxt.setReader(context.getReader());
+ ctxt.setWriter(context.getWriter());
+ ctxt.setErrorWriter(context.getErrorWriter());
+
+ return ctxt;
+
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/script/Bindings.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/script/Bindings.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/script/Bindings.java 2007-05-17 20:41:04 UTC (rev 3222)
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.script;
+import java.util.Map;
+
+/**
+ * A mapping of key/value pairs, all of whose keys are
+ * <code>Strings</code>.
+ *
+ * @version 1.0
+ * @author Mike Grogan
+ * @since 1.6
+ */
+public interface Bindings extends Map<String, Object> {
+ /**
+ * Set a named value.
+ *
+ * @param name The name associated with the value.
+ * @param value The value associated with the name.
+ *
+ * @return The value previously associated with the given name.
+ * Returns null if no value was previously associated with the name.
+ *
+ * @throws NullPointerException if the name is null.
+ * @throws IllegalArgumentException if the name is empty String.
+ */
+ public Object put(String name, Object value);
+
+ /**
+ * Adds all the mappings in a given <code>Map</code> to this <code>Bindings</code>.
+ * @param toMerge The <code>Map</code> to merge with this one.
+ *
+ * @throws NullPointerException
+ * if toMerge map is null or if some key in the map is null.
+ * @throws IllegalArgumentException
+ * if some key in the map is an empty String.
+ */
+ public void putAll(Map<? extends String, ? extends Object> toMerge);
+
+ /**
+ * Returns <tt>true</tt> if this map contains a mapping for the specified
+ * key. More formally, returns <tt>true</tt> if and only if
+ * this map contains a mapping for a key <tt>k</tt> such that
+ * <tt>(key==null ? k==null : key.equals(k))</tt>. (There can be
+ * at most one such mapping.)
+ *
+ * @param key key whose presence in this map is to be tested.
+ * @return <tt>true</tt> if this map contains a mapping for the specified
+ * key.
+ *
+ * @throws NullPointerException if key is null
+ * @throws ClassCastException if key is not String
+ * @throws IllegalArgumentException if key is empty String
+ */
+ public boolean containsKey(Object key);
+
+ /**
+ * Returns the value to which this map maps the specified key. Returns
+ * <tt>null</tt> if the map contains no mapping for this key. A return
+ * value of <tt>null</tt> does not <i>necessarily</i> indicate that the
+ * map contains no mapping for the key; it's also possible that the map
+ * explicitly maps the key to <tt>null</tt>. The <tt>containsKey</tt>
+ * operation may be used to distinguish these two cases.
+ *
+ * <p>More formally, if this map contains a mapping from a key
+ * <tt>k</tt> to a value <tt>v</tt> such that <tt>(key==null ? k==null :
+ * key.equals(k))</tt>, then this method returns <tt>v</tt>; otherwise
+ * it returns <tt>null</tt>. (There can be at most one such mapping.)
+ *
+ * @param key key whose associated value is to be returned.
+ * @return the value to which this map maps the specified key, or
+ * <tt>null</tt> if the map contains no mapping for this key.
+ *
+ * @throws NullPointerException if key is null
+ * @throws ClassCastException if key is not String
+ * @throws IllegalArgumentException if key is empty String
+ */
+ public Object get(Object key);
+
+ /**
+ * Removes the mapping for this key from this map if it is present
+ * (optional operation). More formally, if this map contains a mapping
+ * from key <tt>k</tt> to value <tt>v</tt> such that
+ * <code>(key==null ? k==null : key.equals(k))</code>, that mapping
+ * is removed. (The map can contain at most one such mapping.)
+ *
+ * <p>Returns the value to which the map previously associated the key, or
+ * <tt>null</tt> if the map contained no mapping for this key. (A
+ * <tt>null</tt> return can also indicate that the map previously
+ * associated <tt>null</tt> with the specified key if the implementation
+ * supports <tt>null</tt> values.) The map will not contain a mapping for
+ * the specified key once the call returns.
+ *
+ * @param key key whose mapping is to be removed from the map.
+ * @return previous value associated with specified key, or <tt>null</tt>
+ * if there was no mapping for key.
+ *
+ * @throws NullPointerException if key is null
+ * @throws ClassCastException if key is not String
+ * @throws IllegalArgumentException if key is empty String
+ */
+ public Object remove(Object key);
+}
Added: trunk/core/src/openjdk/javax/javax/script/Compilable.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/script/Compilable.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/script/Compilable.java 2007-05-17 20:41:04 UTC (rev 3222)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.script;
+
+import java.util.Map;
+import java.io.Reader;
+
+/**
+ * The optional interface implemented by ScriptEngines whose methods compile scripts
+ * to a form that can be executed repeatedly without recompilation.
+ *
+ * @author Mike Grogan
+ * @version 1.0
+ * @since 1.6
+ */
+public interface Compilable {
+ /**
+ * Compiles the script (source represented as a <code>String</code>) for
+ * later execution.
+ *
+ * @param script The source of the script, represented as a <code>String</code>.
+ *
+ * @return An subclass of <code>CompiledScript</code> to be executed later using one
+ * of the <code>eval</code> methods of <code>CompiledScript</code>.
+ *
+ * @throws ScriptException if compilation fails.
+ * @throws NullPointerException if the argument is null.
+ *
+ */
+
+ public CompiledScript compile(String script) throws
+ ScriptException;
+
+ /**
+ * Compiles the script (source read from <code>Reader</code>) for
+ * later execution. Functionality is identical to
+ * <code>compile(String)</code> other than the way in which the source is
+ * passed.
+ *
+ * @param script The reader from which the script source is obtained.
+ *
+ * @return An implementation of <code>CompiledScript</code> to be executed
+ * later using one of its <code>eval</code> methods of <code>CompiledScript</code>.
+ *
+ * @throws ScriptException if compilation fails.
+ * @throws NullPointerException if argument is null.
+ */
+ public CompiledScript compile(Reader script) throws
+ ScriptException;
+}
Added: trunk/core/src/openjdk/javax/javax/script/CompiledScript.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/script/CompiledScript.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/script/CompiledScript.java 2007-05-17 20:41:04 UTC (rev 3222)
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.script;
+
+import java.util.Map;
+
+/**
+ * Extended by classes that store results of compilations. State
+ * might be stored in the form of Java classes, Java class files or scripting
+ * language opcodes. The script may be executed repeatedly
+ * without reparsing.
+ * <br><br>
+ * Each <code>CompiledScript</code> is associated with a <code>ScriptEngine</code> -- A call to an <code>eval</code>
+ * method of the <code>CompiledScript</code> causes the execution of the script by the
+ * <code>ScriptEngine</code>. Changes in the state of the <code>ScriptEngine</code> caused by execution
+ * of tne <code>CompiledScript</code> may visible during subsequent executions of scripts by the engine.
+ *
+ * @author Mike Grogan
+ * @version 1.0
+ * @since 1.6
+ */
+public abstract class CompiledScript {
+
+ /**
+ * Executes the program stored in this <code>CompiledScript</code> object.
+ *
+ * @param context A <code>ScriptContext</code> that is used in the same way as
+ * the <code>ScriptContext</code> passed to the <code>eval</code> methods of
+ * <code>ScriptEngine</code>.
+ *
+ * @return The value returned by the script execution, if any. Should return <code>null</code>
+ * if no value is returned by the script execution.
+ *
+ * @throws ScriptException if an error occurs.
+ * @throws NullPointerException if context is null.
+ */
+
+ public abstract Object eval(ScriptContext context) throws ScriptException;
+
+ /**
+ * Executes the program stored in the <code>CompiledScript</code> object using
+ * the supplied <code>Bindings</code> of attributes as the <code>ENGINE_SCOPE</code> of the
+ * associated <code>ScriptEngine</code> during script execution. If bindings is null,
+ * then the effect of calling this method is same as that of eval(getEngine().getContext()).
+ * <p>.
+ * The <code>GLOBAL_SCOPE</code> <code>Bindings</code>, <code>Reader</code> and <code>Writer</code>
+ * associated with the default <code>ScriptContext</code> of the associated <code>ScriptEngine</code> are used.
+ *
+ * @param bindings The bindings of attributes used for the <code>ENGINE_SCOPE</code>.
+ *
+ * @return The return value from the script execution
+ *
+ * @throws ScriptException if an error occurs.
+ */
+ public Object eval(Bindings bindings) throws ScriptException {
+
+ ScriptContext ctxt = getEngine().getContext();
+
+ if (bindings != null) {
+ SimpleScriptContext tempctxt = new SimpleScriptContext();
+ tempctxt.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
+ tempctxt.setBindings(ctxt.getBindings(ScriptContext.GLOBAL_SCOPE),
+ ScriptContext.GLOBAL_SCOPE);
+ tempctxt.setWriter(ctxt.getWriter());
+ tempctxt.setReader(ctxt.getReader());
+ tempctxt.setErrorWriter(ctxt.getErrorWriter());
+ ctxt = tempctxt;
+ }
+
+ return eval(ctxt);
+ }
+
+
+ /**
+ * Executes the program stored in the <code>CompiledScript</code> object. The
+ * default <code>ScriptContext</code> of the associated <code>ScriptEngine</code> is used.
+ * The effect of calling this method is same as that of eval(getEngine().getContext()).
+ *
+ * @return The return value from the script execution
+ *
+ * @throws ScriptException if an error occurs.
+ */
+ public Object eval() throws ScriptException {
+ return eval(getEngine().getContext());
+ }
+
+ /**
+ * Returns the <code>ScriptEngine</code> wbose <code>compile</code> method created this <code>CompiledScript</code>.
+ * The <code>CompiledScript</code> will execute in this engine.
+ *
+ * @return The <code>ScriptEngine</code> that created this <code>CompiledScript</code>
+ */
+ public abstract ScriptEngine getEngine();
+
+}
Added: trunk/core/src/openjdk/javax/javax/script/Invocable.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/script/Invocable.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/script/Invocable.java 2007-05-17 20:41:04 UTC (rev 3222)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.script;
+
+/**
+ * The optional interface implemented by ScriptEngines whose methods allow the invocation of
+ * procedures in scripts that have previously been executed.
+ *
+ * @version 1.0
+ * @author Mike Grogan
+ * @author A. Sundararajan
+ * @since 1.6
+ */
+public interface Invocable {
+ /**
+ * Calls a method on a script object compiled during a previous script execution,
+ * which is retained in the state of the <code>ScriptEngine</code>.
+ *
+ * @param name The name of the procedure to be called.
+ *
+ * @param thiz If the procedure is a member of a class
+ * defined in the script and thiz is an instance of that class
+ * returned by a previous execution or invocation, the named method is
+ * called through that instance.
+ *
+ * @param args Arguments to pass to the procedure. The rules for converting
+ * the arguments to scripting variables are implementation-specific.
+ *
+ * @return The value returned by the procedure. The rules for converting the scripting
+ * variable returned by the script method to a Java Object are implementation-specific.
+ *
+ * @throws ScriptException if an error occurrs during invocation of the method.
+ * @throws NoSuchMethodException if method with given name or matching argument types cannot be found.
+ * @throws NullPointerException if the method name is null.
+ * @throws IllegalArgumentException if the specified thiz is null or the specified Object is
+ * does not represent a scripting object.
+ */
+ public Object invokeMethod(Object thiz, String name, Object... args)
+ throws ScriptException, NoSuchMethodException;
+
+ /**
+ * Used to call top-level procedures and functions defined in scripts.
+ *
+ * @param args Arguments to pass to the procedure or function
+ * @return The value returned by the procedure or function
+ *
+ * @throws ScriptException if an error occurrs during invocation of the method.
+ * @throws NoSuchMethodException if method with given name or matching argument types cannot be found.
+ * @throws NullPointerException if method name is null.
+ */
+ public Object invokeFunction(String name, Object... args)
+ throws ScriptException, NoSuchMethodException;
+
+
+ /**
+ * Returns an implementation of an interface using functions compiled in
+ * the interpreter. The methods of the interface
+ * may be implemented using the <code>invokeFunction</code> method.
+ *
+ * @param clasz The <code>Class</code> object of the interface to return.
+ *
+ * @return An instance of requested interface - null if the requested interface is unavailable,
+ * i. e. if compiled functions in the <code>ScriptEngine</code> cannot be found matching
+ * the ones in the requested interface.
+ *
+ * @throws IllegalArgumentException if the specified <code>Class</code> object
+ * is null or is not an interface.
+ */
+ public <T> T getInterface(Class<T> clasz);
+
+ /**
+ * Returns an implementation of an interface using member functions of
+ * a scripting object compiled in the interpreter. The methods of the
+ * interface may be implemented using the <code>invokeMethod</code> method.
+ *
+ * @param thiz The scripting object whose member functions are used to implement the methods of the interface.
+ * @param clasz The <code>Class</code> object of the interface to return.
+ *
+ * @return An instance of requested interface - null if the requested interface is unavailable,
+ * i. e. if compiled methods in the <code>ScriptEngine</code> cannot be found matching
+ * the ones in the requested interface.
+ *
+ * @throws IllegalArgumentException if the specified <code>Class</code> object
+ * is null or is not an interface, or if the specified Object is
+ * null or does not represent a scripting object.
+ */
+ public <T> T getInterface(Object thiz, Class<T> clasz);
+
+}
Added: trunk/core/src/openjdk/javax/javax/script/ScriptContext.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/script/ScriptContext.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/script/ScriptContext.java 2007-05-17 20:41:04 UTC (rev 3222)
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.script;
+import java.util.List;
+import java.io.Writer;
+import java.io.Reader;
+
+/**
+ * The interface whose implementing classes are used to connect Script Engines
+ * with objects, such as scoped Bindings, in hosting applications. Each scope is a set
+ * of named attributes whose values can be set and retrieved using the
+ * <code>ScriptContext</code> methods. ScriptContexts also expose Readers and Writers
+ * that can be used by the ScriptEngines for input and output.
+ *
+ * @author Mike Grogan
+ * @version 1.0
+ * @since 1.6
+ */
+public interface ScriptContext {
+
+
+ /**
+ * EngineScope attributes are visible during the lifetime of a single
+ * <code>ScriptEngine</code> and a set of attributes is maintained for each
+ * engine.
+ */
+ public static final int ENGINE_SCOPE = 100;
+
+ /**
+ * GlobalScope attributes are visible to all engines created by same ScriptEngineFactory.
+ */
+ public static final int GLOBAL_SCOPE = 200;
+
+
+ /**
+ * Associates a <code>Bindings</code> instance with a particular scope in this
+ * <code>ScriptContext</code>. Calls to the <code>getAttribute</code> and
+ * <code>setAttribute</code> methods must map to the <code>get</code> and
+ * <code>put</code> methods of the <code>Bindings</code> for the specified scope.
+ *
+ * @param bindings The <code>Bindings</code> to associate with the given scope
+ * @param scope The scope
+ *
+ * @throws IllegalArgumentException If no <code>Bindings</code> is defined for the
+ * specified scope value in ScriptContexts of this type.
+ * @throws NullPointerException if value of scope is <code>ENGINE_SCOPE</code> and
+ * the specified <code>Bindings</code> is null.
+ *
+ */
+ public void setBindings(Bindings bindings, int scope);
+
+ /**
+ * Gets the <code>Bindings</code> associated with the given scope in this
+ * <code>ScriptContext</code>.
+ *
+ * @return The associated <code>Bindings</code>. Returns <code>null</code> if it has not
+ * been set.
+ *
+ * @throws IllegalArgumentException If no <code>Bindings</code> is defined for the
+ * specified scope value in <code>ScriptContext</code> of this type.
+ */
+ public Bindings getBindings(int scope);
+
+ /**
+ * Sets the value of an attribute in a given scope.
+ *
+ * @param name The name of the attribute to set
+ * @param value The value of the attribute
+ * @param scope The scope in which to set the attribute
+ *
+ * @throws IllegalArgumentException
+ * if the name is empty or if the scope is invalid.
+ * @throws NullPointerException if the name is null.
+ */
+ public void setAttribute(String name, Object value, int scope);
+
+ /**
+ * Gets the value of an attribute in a given scope.
+ *
+ * @param name The name of the attribute to retrieve.
+ * @param scope The scope in which to retrieve the attribute.
+ * @return The value of the attribute. Returns <code>null</code> is the name
+ * does not exist in the given scope.
+ *
+ * @throws IllegalArgumentException
+ * if the name is empty or if the value of scope is invalid.
+ * @throws NullPointerException if the name is null.
+ */
+ public Object getAttribute(String name, int scope);
+
+ /**
+ * Remove an attribute in a given scope.
+ *
+ * @param name The name of the attribute to remove
+ * @param scope The scope in which to remove the attribute
+ *
+ * @return The removed value.
+ * @throws IllegalArgumentException
+ * if the name is empty or if the scope is invalid.
+ * @throws NullPointerException if the name is null.
+ */
+ public Object removeAttribute(String name, int scope);
+
+ /**
+ * Retrieves the value of the attribute with the given name in
+ * the scope occurring earliest in the search order. The order
+ * is determined by the numeric value of the scope parameter (lowest
+ * scope values first.)
+ *
+ * @param name The name of the the attribute to retrieve.
+ * @return The value of the attribute in the lowest scope for
+ * which an attribute with the given name is defined. Returns
+ * null if no attribute with the name exists in any scope.
+ * @throws NullPointerException if the name is null.
+ * @throws IllegalArgumentException if the name is empty.
+ */
+ public Object getAttribute(String name);
+
+
+ /**
+ * Get the lowest scope in which an attribute is defined.
+ * @param name Name of the attribute
+ * .
+ * @return The lowest scope. Returns -1 if no attribute with the given
+ * name is defined in any scope.
+ * @throws NullPointerException if name is null.
+ * @throws IllegalArgumentException if name is empty.
+ */
+ public int getAttributesScope(String name);
+
+ /**
+ * Returns the <code>Writer</code> for scripts to use when displaying output.
+ *
+ * @return The <code>Writer</code>.
+ */
+ public Writer getWriter();
+
+
+ /**
+ * Returns the <code>Writer</code> used to display error output.
+ *
+ * @return The <code>Writer</code>
+ */
+ public Writer getErrorWriter();
+
+ /**
+ * Sets the <code>Writer</code> for scripts to use when displaying output.
+ *
+ * @param writer The new <code>Writer</code>.
+ */
+ public void setWriter(Writer writer);
+
+
+ /**
+ * Sets the <code>Writer</code> used to display error output.
+ *
+ * @param writer The <code>Writer</code>.
+ */
+ public void setErrorWriter(Writer writer);
+
+ /**
+ * Returns a <code>Reader</code> to be used by the script to read
+ * input.
+ *
+ * @return The <code>Reader</code>.
+ */
+ public Reader getReader();
+
+
+ /**
+ * Sets the <code>Reader</code> for scripts to read input
+ * .
+ * @param reader The new <code>Reader</code>.
+ */
+ public void setReader(Reader reader);
+
+ /**
+ * Returns immutable <code>List</code> of all the valid values for
+ * scope in the ScriptContext.
+ *
+ * @return list of scope values
+ */
+ public List<Integer> getScopes();
+}
Added: trunk/core/src/openjdk/javax/javax/script/ScriptEngine.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/script/ScriptEngine.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/script/ScriptEngine.java 2007-05-17 20:41:04 UTC (rev 3222)
@@ -0,0 +1,324 @@
+/*
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.script;
+
+import java.io.Reader;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * <code>ScriptEngine</code> is the fundamental interface whose methods must be
+ * fully functional in every implementation of this specification.
+ * <br><br>
+ * These methods provide basic scripting functionality. Applications written to this
+ * simple interface are expected to work with minimal modifications in every implementation.
+ * It includes methods that execute scripts, and ones that set and get values.
+ * <br><br>
+ * The values are key/value pairs of two types. The first type of pairs consists of
+ * those whose keys are reserved and defined in this specification or by individual
+ * implementations. The values in the pairs with reserved keys have specified meanings.
+ * <br><br>
+ * The other type of pairs consists of those that create Java language Bindings, the values are
+ * usually represented in scripts by the corresponding keys or by decorated forms of them.
+ *
+ * @author Mike Grogan
+ * @version 1.0
+ * @since 1.6
+ */
+
+public interface ScriptEngine {
+
+ /**
+ * Reserved key for a named value that passes
+ * an array of positional arguments to a script.
+ */
+ public static final String ARGV="javax.script.argv";
+
+ /**
+ * Reserved key for a named value that is
+ * the name of the file being executed.
+ */
+ public static final String FILENAME = "javax.script.filename";
+
+ /**
+ * Reserved key for a named value that is
+ * the name of the <code>ScriptEngine</code> implementation.
+ */
+ public static final String ENGINE = "javax.script.engine";
+
+ /**
+ * Reserved key for a named value that identifies
+ * the version of the <code>ScriptEngine</code> implementation.
+ */
+ public static final String ENGINE_VERSION = "javax.script.engine_version";
+
+ /**
+ * Reserved key for a named value that identifies
+ * the short name of the scripting language. The name is used by the
+ * <code>ScriptEngineManager</code> to locate a <code>ScriptEngine</code>
+ * with a given name in the <code>getEngineByName</code> method.
+ */
+ public static final String NAME = "javax.script.name";
+
+ /**
+ * Reserved key for a named value that is
+ * the full name of Scripting Language supported by the implementation.
+ */
+ public static final String LANGUAGE = "javax.script.language";
+
+ /**
+ * Reserved key for the named value that identifies
+ * the version of the scripting language supported by the implementation.
+ */
+ public static final String LANGUAGE_VERSION ="javax.script.language_version";
+
+
+ /**
+ * Causes the immediate execution of the script whose source is the String
+ * passed as the first argument. The script may be reparsed or recompiled before
+ * execution. State left in the engine from previous executions, including
+ * variable values and compiled procedures may be visible during this execution.
+ *
+ * @param script The script to be executed by the script engine.
+ *
+ * @param context A <code>ScriptContext</code> exposing sets of attributes in
+ * different scopes. The meanings of the scopes <code>ScriptContext.GLOBAL_SCOPE</code>,
+ * and <code>ScriptContext.ENGINE_SCOPE</code> are defined in the specification.
+ * <br><br>
+ * The <code>ENGINE_SCOPE</code> <code>Bindings</code> of the <code>ScriptContext</code> contains the
+ * bindings of scripting variables to application objects to be used during this
+ * script execution.
+ *
+ *
+ * @return The value returned from the execution of the script.
+ *
+ * @throws ScriptException if an error occurrs in script. ScriptEngines should create and throw
+ * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting
+ * implementations.
+ * @throws NullPointerException if either argument is null.
+ */
+ public Object eval(String script, ScriptContext context) throws ScriptException;
+
+
+ /**
+ * Same as <code>eval(String, ScriptContext)</code> where the source of the script
+ * is read from a <code>Reader</code>.
+ *
+ * @param reader The source of the script to be executed by the script engine.
+ *
+ * @param context The <code>ScriptContext</code> passed to the script engine.
+ *
+ * @return The value returned from the execution of the script.
+ *
+ * @throws ScriptException if an error occurrs in script.
+ * @throws NullPointerException if either argument is null.
+ */
+ public Object eval(Reader reader , ScriptContext context) throws ScriptException;
+
+ /**
+ * Executes the specified script. The default <code>ScriptContext</code> for the <code>ScriptEngine</code>
+ * is used.
+ *
+ * @param script The script language source to be executed.
+ *
+ * @return The value returned from the execution of the script.
+ *
+ * @throws ScriptException if error occurrs in script.
+ * @throws NullPointerException if the argument is null.
+ */
+ public Object eval(String script) throws ScriptException;
+
+ /**
+ * Same as <code>eval(String)</code> except that the source of the script is
+ * provided as a <code>Reader</code>
+ *
+ * @param reader The source of the script.
+ *
+ * @return The value returned by the script.
+ *
+ * @throws ScriptException if an error occurrs in script.
+ * @throws NullPointerException if the argument is null.
+ */
+ public Object eval(Reader reader) throws ScriptException;
+
+ /**
+ * Executes the script using the <code>Bindings</code> argument as the <code>ENGINE_SCOPE</code>
+ * <code>Bindings</code> of the <code>ScriptEngine</code> during the script execution. The
+ * <code>Reader</code>, <code>Writer</code> and non-<code>ENGINE_SCOPE</code> <code>Bindings</code> of the
+ * default <code>ScriptContext</code> are used. The <code>ENGINE_SCOPE</code>
+ * <code>Bindings</code> of the <code>ScriptEngine</code> is not changed, and its
+ * mappings are unaltered by the script execution.
+ *
+ * @param script The source for the script.
+ *
+ * @param n The <code>Bindings</code> of attributes to be used for script execution.
+ *
+ * @return The value returned by the script.
+ *
+ * @throws ScriptException if an error occurrs in script.
+ * @throws NullPointerException if either argument is null.
+ */
+ public Object eval(String script, Bindings n) throws ScriptException;
+
+ /**
+ * Same as <code>eval(String, Bindings)</code> except that the source of the script
+ * is provided as a <code>Reader</code>.
+ *
+ * @param reader The source of the script.
+ * @param n The <code>Bindings</code> of attributes.
+ *
+ * @return The value returned by the script.
+ *
+ * @throws ScriptException if an error occurrs.
+ * @throws NullPointerException if either argument is null.
+ */
+ public Object eval(Reader reader , Bindings n) throws ScriptException;
+
+
+
+ /**
+ * Sets a key/value pair in the state of the ScriptEngine that may either create
+ * a Java Language Binding to be used in the execution of scripts or be used in some
+ * other way, depending on whether the key is reserved. Must have the same effect as
+ * <code>getBindings(ScriptContext.ENGINE_SCOPE).put</code>.
+ *
+ * @param key The name of named value to add
+ * @param value The value of named value to add.
+ *
+ * @throws NullPointerException if key is null.
+ * @throws IllegalArgumentException if key is empty.
+ */
+ public void put(String key, Object value);
+
+
+ /**
+ * Retrieves a value set in the state of this engine. The value might be one
+ * which was set using <code>setValue</code> or some other value in the state
+ * of the <code>ScriptEngine</code>, depending on the implementation. Must have the same effect
+ * as <code>getBindings(ScriptContext.ENGINE_SCOPE).get</code>
+ *
+ * @param key The key whose value is to be returned
+ * @return the value for the given key
+ *
+ * @throws NullPointerException if key is null.
+ * @throws IllegalArgumentException if key is empty.
+ */
+ public Object get(String key);
+
+
+ /**
+ * Returns a scope of named values. The possible scopes are:
+ * <br><br>
+ * <ul>
+ * <li><code>ScriptContext.GLOBAL_SCOPE</code> - The set of named values representing global
+ * scope. If this <code>ScriptEngine</code> is created by a <code>ScriptEngineManager</code>,
+ * then the manager sets global scope bindings. This may be <code>null</code> if no global
+ * scope is associated with this <code>ScriptEngine</code></li>
+ * <li><code>ScriptContext.ENGINE_SCOPE</code> - The set of named values representing the state of
+ * this <code>ScriptEngine</code>. The values are generally visible in scripts using
+ * the associated keys as variable names.</li>
+ * <li>Any other value of scope defined in the default <code>ScriptContext</code> of the <code>ScriptEngine</code>.
+ * </li>
+ * </ul>
+ * <br><br>
+ * The <code>Bindings</code> instances that are returned must be identical to those returned by the
+ * <code>getBindings</code> method of <code>ScriptContext</code> called with corresponding arguments on
+ * the default <code>ScriptContext</code> of the <code>ScriptEngine</code>.
+ *
+ * @param scope Either <code>ScriptContext.ENGINE_SCOPE</code> or <code>ScriptContext.GLOBAL_SCOPE</code>
+ * which specifies the <code>Bindings</code> to return. Implementations of <code>ScriptContext</code>
+ * may define additional scopes. If the default <code>ScriptContext</code> of the <code>ScriptEngine</code>
+ * defines additional scopes, any of them can be passed to get the corresponding <code>Bindings</code>.
+ *
+ * @return The <code>Bindings</code> with the specified scope.
+ *
+ * @throws IllegalArgumentException if specified scope is invalid
+ *
+ */
+ public Bindings getBindings(int scope);
+
+ /**
+ * Sets a scope of named values to be used by scripts. The possible scopes are:
+ *<br><br>
+ * <ul>
+ * <li><code>ScriptContext.ENGINE_SCOPE</code> - The specified <code>Bindings</code> replaces the
+ * engine scope of the <code>ScriptEngine</code>.
+ * </li>
+ * <li><code>ScriptContext.GLOBAL_SCOPE</code> - The specified <code>Bindings</code> must be visible
+ * as the <code>GLOBAL_SCOPE</code>.
+ * </li>
+ * <li>Any other value of scope defined in the default <code>ScriptContext</code> of the <code>ScriptEngine</code>.
+ *</li>
+ * </ul>
+ * <br><br>
+ * The method must have the same effect as calling the <code>setBindings</code> method of
+ * <code>ScriptContext</code> with the corresponding value of <code>scope</code> on the default
+ * <code>ScriptContext</code> of the <code>ScriptEngine</code>.
+ *
+ * @param bindings The <code>Bindings</code> for the specified scope.
+ * @param scope The specified scope. Either <code>ScriptContext.ENGINE_SCOPE</code>,
+ * <code>ScriptContext.GLOBAL_SCOPE</code>, or any other valid value of scope.
+ *
+ * @throws IllegalArgumentException if the scope is invalid
+ * @throws NullPointerException if the bindings is null and the scope is
+ * <code>ScriptContext.ENGINE_SCOPE</code>
+ */
+ public void setBindings(Bindings bindings, int scope);
+
+
+ /**
+ * Returns an uninitialized <code>Bindings</code>.
+ *
+ * @return A <code>Bindings</code> that can be used to replace the state of this <code>ScriptEngine</code>.
+ **/
+ public Bindings createBindings();
+
+
+ /**
+ * Returns the default <code>ScriptContext</code> of the <code>ScriptEngine</code> whose Bindings, Reader
+ * and Writers are used for script executions when no <code>ScriptContext</code> is specified.
+ *
+ * @return The default <code>ScriptContext</code> of the <code>ScriptEngine</code>.
+ */
+ public ScriptContext getContext();
+
+ /**
+ * Sets the default <code>ScriptContext</code> of the <code>ScriptEngine</code> whose Bindings, Reader
+ * and Writers are used for script executions when no <code>ScriptContext</code> is specified.
+ *
+ * @param context A <code>ScriptContext</code> that will replace the default <code>ScriptContext</code> in
+ * the <code>ScriptEngine</code>.
+ * @throws NullPointerException if context is null.
+ */
+ public void setContext(ScriptContext context);
+
+ /**
+ * Returns a <code>ScriptEngineFactory</code> for the class to which this <code>ScriptEngine</code> belongs.
+ *
+ * @return The <code>ScriptEngineFactory</code>
+ */
+ public ScriptEngineFactory getFactory();
+}
Added: trunk/core/src/openjdk/javax/javax/script/ScriptEngineFactory.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/script/ScriptEngineFactory.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/script/ScriptEngineFactory.java 2007-05-17 20:41:04 UTC (rev 3222)
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.script;
+
+import java.util.List;
+
+/**
+ * <code>ScriptEngineFactory</code> is used to describe and instantiate
+ * <code>ScriptEngines</code>.
+ * <br><br>
+ * Each class implementing <code>ScriptEngine</code> has a corresponding factory
+ * that exposes metadata describing the engine class.
+ * <br><br>The <code>ScriptEngineManager</code>
+ * uses the service provider mechanism described in the <i>Jar File Specification</i> to obtain
+ * instances of all <code>ScriptEngineFactories</code> available in
+ * the current ClassLoader.
+ *
+ * @since 1.6
+ */
+public interface ScriptEngineFactory {
+ /**
+ * Returns the full name of the <code>ScriptEngine</code>. For
+ * instance an implementation based on the Mozilla Rhino Javascript engine
+ * might return <i>Rhino Mozilla Javascript Engine</i>.
+ * @return The name of the engine implementation.
+ */
+ public String getEngineName();
+
+ /**
+ * Returns the version of the <code>ScriptEngine</code>.
+ * @return The <code>ScriptEngine</code> implementation version.
+ */
+ public String getEngineVersion();
+
+
+ /**
+ * Returns an immutable list of filename extensions, which generally identify scripts
+ * written in the language supported by this <code>ScriptEngine</code>.
+ * The array is used by the <code>ScriptEngineManager</code> to implement its
+ * <code>getEngineByExtension</code> method.
+ * @return The list of extensions.
+ */
+ public List<String> getExtensions();
+
+
+ /**
+ * Returns an immutable list of mimetypes, associated with scripts that
+ * can be executed by the engine. The list is used by the
+ * <code>ScriptEngineManager</code> class to implement its
+ * <code>getEngineByMimetype</code> method.
+ * @return The list of mime types.
+ */
+ public List<String> getMimeTypes();
+
+ /**
+ * Returns an immutable list of short names for the <code>ScriptEngine</code>, which may be used to
+ * identify the <code>ScriptEngine</code> by the <code>ScriptEngineManager</code>.
+ * For instance, an implementation based on the Mozilla Rhino Javascript engine might
+ * return list containing {"javascript", "rhino"}.
+ */
+ public List<String> getNames();
+
+ /**
+ * Returns the name of the scripting langauge supported by this
+ * <code>ScriptEngine</code>.
+ * @return The name of the supported language.
+ */
+ public String getLanguageName();
+
+ /**
+ * Returns the version of the scripting language supported by this
+ * <code>ScriptEngine</code>.
+ * @return The version of the supported language.
+ */
+ public String getLanguageVersion();
+
+ /**
+ ...
[truncated message content] |
|
From: <ls...@us...> - 2007-05-17 20:40:36
|
Revision: 3221
http://jnode.svn.sourceforge.net/jnode/?rev=3221&view=rev
Author: lsantha
Date: 2007-05-17 13:40:30 -0700 (Thu, 17 May 2007)
Log Message:
-----------
Openjdk patches.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/misc/Service.java
trunk/core/src/openjdk/sun/sun/misc/ServiceConfigurationError.java
trunk/core/src/openjdk/sun/sun/reflect/
trunk/core/src/openjdk/sun/sun/reflect/Reflection.java
trunk/core/src/openjdk/sun/sun/security/util/
trunk/core/src/openjdk/sun/sun/security/util/SecurityConstants.java
Added: trunk/core/src/openjdk/sun/sun/misc/Service.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/misc/Service.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/misc/Service.java 2007-05-17 20:40:30 UTC (rev 3221)
@@ -0,0 +1,427 @@
+/*
+ * Copyright 1999-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.misc;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.TreeSet;
+
+
+/**
+ * A simple service-provider lookup mechanism. A <i>service</i> is a
+ * well-known set of interfaces and (usually abstract) classes. A <i>service
+ * provider</i> is a specific implementation of a service. The classes in a
+ * provider typically implement the interfaces and subclass the classes defined
+ * in the service itself. Service providers may be installed in an
+ * implementation of the Java platform in the form of extensions, that is, jar
+ * files placed into any of the usual extension directories. Providers may
+ * also be made available by adding them to the applet or application class
+ * path or by some other platform-specific means.
+ *
+ * <p> In this lookup mechanism a service is represented by an interface or an
+ * abstract class. (A concrete class may be used, but this is not
+ * recommended.) A provider of a given service contains one or more concrete
+ * classes that extend this <i>service class</i> with data and code specific to
+ * the provider. This <i>provider class</i> will typically not be the entire
+ * provider itself but rather a proxy that contains enough information to
+ * decide whether the provider is able to satisfy a particular request together
+ * with code that can create the actual provider on demand. The details of
+ * provider classes tend to be highly service-specific; no single class or
+ * interface could possibly unify them, so no such class has been defined. The
+ * only requirement enforced here is that provider classes must have a
+ * zero-argument constructor so that they may be instantiated during lookup.
+ *
+ * <p> A service provider identifies itself by placing a provider-configuration
+ * file in the resource directory <tt>META-INF/services</tt>. The file's name
+ * should consist of the fully-qualified name of the abstract service class.
+ * The file should contain a list of fully-qualified concrete provider-class
+ * names, one per line. Space and tab characters surrounding each name, as
+ * well as blank lines, are ignored. The comment character is <tt>'#'</tt>
+ * (<tt>0x23</tt>); on each line all characters following the first comment
+ * character are ignored. The file must be encoded in UTF-8.
+ *
+ * <p> If a particular concrete provider class is named in more than one
+ * configuration file, or is named in the same configuration file more than
+ * once, then the duplicates will be ignored. The configuration file naming a
+ * particular provider need not be in the same jar file or other distribution
+ * unit as the provider itself. The provider must be accessible from the same
+ * class loader that was initially queried to locate the configuration file;
+ * note that this is not necessarily the class loader that found the file.
+ *
+ * <p> <b>Example:</b> Suppose we have a service class named
+ * <tt>java.io.spi.CharCodec</tt>. It has two abstract methods:
+ *
+ * <pre>
+ * public abstract CharEncoder getEncoder(String encodingName);
+ * public abstract CharDecoder getDecoder(String encodingName);
+ * </pre>
+ *
+ * Each method returns an appropriate object or <tt>null</tt> if it cannot
+ * translate the given encoding. Typical <tt>CharCodec</tt> providers will
+ * support more than one encoding.
+ *
+ * <p> If <tt>sun.io.StandardCodec</tt> is a provider of the <tt>CharCodec</tt>
+ * service then its jar file would contain the file
+ * <tt>META-INF/services/java.io.spi.CharCodec</tt>. This file would contain
+ * the single line:
+ *
+ * <pre>
+ * sun.io.StandardCodec # Standard codecs for the platform
+ * </pre>
+ *
+ * To locate an encoder for a given encoding name, the internal I/O code would
+ * do something like this:
+ *
+ * <pre>
+ * CharEncoder getEncoder(String encodingName) {
+ * Iterator ps = Service.providers(CharCodec.class);
+ * while (ps.hasNext()) {
+ * CharCodec cc = (CharCodec)ps.next();
+ * CharEncoder ce = cc.getEncoder(encodingName);
+ * if (ce != null)
+ * return ce;
+ * }
+ * return null;
+ * }
+ * </pre>
+ *
+ * The provider-lookup mechanism always executes in the security context of the
+ * caller. Trusted system code should typically invoke the methods in this
+ * class from within a privileged security context.
+ *
+ * @author Mark Reinhold
+ * @version 1.18, 07/05/05
+ * @since 1.3
+ */
+
+public final class Service {
+
+ private static final String prefix = "META-INF/services/";
+
+ private Service() { }
+
+ private static void fail(Class service, String msg, Throwable cause)
+ throws ServiceConfigurationError
+ {
+ ServiceConfigurationError sce
+ = new ServiceConfigurationError(service.getName() + ": " + msg);
+ sce.initCause(cause);
+ throw sce;
+ }
+
+ private static void fail(Class service, String msg)
+ throws ServiceConfigurationError
+ {
+ throw new ServiceConfigurationError(service.getName() + ": " + msg);
+ }
+
+ private static void fail(Class service, URL u, int line, String msg)
+ throws ServiceConfigurationError
+ {
+ fail(service, u + ":" + line + ": " + msg);
+ }
+
+ /**
+ * Parse a single line from the given configuration file, adding the name
+ * on the line to both the names list and the returned set iff the name is
+ * not already a member of the returned set.
+ */
+ private static int parseLine(Class service, URL u, BufferedReader r, int lc,
+ List names, Set returned)
+ throws IOException, ServiceConfigurationError
+ {
+ String ln = r.readLine();
+ if (ln == null) {
+ return -1;
+ }
+ int ci = ln.indexOf('#');
+ if (ci >= 0) ln = ln.substring(0, ci);
+ ln = ln.trim();
+ int n = ln.length();
+ if (n != 0) {
+ if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0))
+ fail(service, u, lc, "Illegal configuration-file syntax");
+ int cp = ln.codePointAt(0);
+ if (!Character.isJavaIdentifierStart(cp))
+ fail(service, u, lc, "Illegal provider-class name: " + ln);
+ for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) {
+ cp = ln.codePointAt(i);
+ if (!Character.isJavaIdentifierPart(cp) && (cp != '.'))
+ fail(service, u, lc, "Illegal provider-class name: " + ln);
+ }
+ if (!returned.contains(ln)) {
+ names.add(ln);
+ returned.add(ln);
+ }
+ }
+ return lc + 1;
+ }
+
+ /**
+ * Parse the content of the given URL as a provider-configuration file.
+ *
+ * @param service
+ * The service class for which providers are being sought;
+ * used to construct error detail strings
+ *
+ * @param url
+ * The URL naming the configuration file to be parsed
+ *
+ * @param returned
+ * A Set containing the names of provider classes that have already
+ * been returned. This set will be updated to contain the names
+ * that will be yielded from the returned <tt>Iterator</tt>.
+ *
+ * @return A (possibly empty) <tt>Iterator</tt> that will yield the
+ * provider-class names in the given configuration file that are
+ * not yet members of the returned set
+ *
+ * @throws ServiceConfigurationError
+ * If an I/O error occurs while reading from the given URL, or
+ * if a configuration-file format error is detected
+ */
+ private static Iterator parse(Class service, URL u, Set returned)
+ throws ServiceConfigurationError
+ {
+ InputStream in = null;
+ BufferedReader r = null;
+ ArrayList names = new ArrayList();
+ try {
+ in = u.openStream();
+ r = new BufferedReader(new InputStreamReader(in, "utf-8"));
+ int lc = 1;
+ while ((lc = parseLine(service, u, r, lc, names, returned)) >= 0);
+ } catch (IOException x) {
+ fail(service, ": " + x);
+ } finally {
+ try {
+ if (r != null) r.close();
+ if (in != null) in.close();
+ } catch (IOException y) {
+ fail(service, ": " + y);
+ }
+ }
+ return names.iterator();
+ }
+
+
+ /**
+ * Private inner class implementing fully-lazy provider lookup
+ */
+ private static class LazyIterator implements Iterator {
+
+ Class service;
+ ClassLoader loader;
+ Enumeration configs = null;
+ Iterator pending = null;
+ Set returned = new TreeSet();
+ String nextName = null;
+
+ private LazyIterator(Class service, ClassLoader loader) {
+ this.service = service;
+ this.loader = loader;
+ }
+
+ public boolean hasNext() throws ServiceConfigurationError {
+ if (nextName != null) {
+ return true;
+ }
+ if (configs == null) {
+ try {
+ String fullName = prefix + service.getName();
+ if (loader == null)
+ configs = ClassLoader.getSystemResources(fullName);
+ else
+ configs = loader.getResources(fullName);
+ } catch (IOException x) {
+ fail(service, ": " + x);
+ }
+ }
+ while ((pending == null) || !pending.hasNext()) {
+ if (!configs.hasMoreElements()) {
+ return false;
+ }
+ pending = parse(service, (URL)configs.nextElement(), returned);
+ }
+ nextName = (String)pending.next();
+ return true;
+ }
+
+ public Object next() throws ServiceConfigurationError {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ String cn = nextName;
+ nextName = null;
+ try {
+ return Class.forName(cn, true, loader).newInstance();
+ } catch (ClassNotFoundException x) {
+ fail(service,
+ "Provider " + cn + " not found");
+ } catch (Exception x) {
+ fail(service,
+ "Provider " + cn + " could not be instantiated: " + x,
+ x);
+ }
+ return null; /* This cannot happen */
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+
+ /**
+ * Locates and incrementally instantiates the available providers of a
+ * given service using the given class loader.
+ *
+ * <p> This method transforms the name of the given service class into a
+ * provider-configuration filename as described above and then uses the
+ * <tt>getResources</tt> method of the given class loader to find all
+ * available files with that name. These files are then read and parsed to
+ * produce a list of provider-class names. The iterator that is returned
+ * uses the given class loader to lookup and then instantiate each element
+ * of the list.
+ *
+ * <p> Because it is possible for extensions to be installed into a running
+ * Java virtual machine, this method may return different results each time
+ * it is invoked. <p>
+ *
+ * @param service
+ * The service's abstract service class
+ *
+ * @param loader
+ * The class loader to be used to load provider-configuration files
+ * and instantiate provider classes, or <tt>null</tt> if the system
+ * class loader (or, failing that the bootstrap class loader) is to
+ * be used
+ *
+ * @return An <tt>Iterator</tt> that yields provider objects for the given
+ * service, in some arbitrary order. The iterator will throw a
+ * <tt>ServiceConfigurationError</tt> if a provider-configuration
+ * file violates the specified format or if a provider class cannot
+ * be found and instantiated.
+ *
+ * @throws ServiceConfigurationError
+ * If a provider-configuration file violates the specified format
+ * or names a provider class that cannot be found and instantiated
+ *
+ * @see #providers(java.lang.Class)
+ * @see #installedProviders(java.lang.Class)
+ */
+ public static Iterator providers(Class service, ClassLoader loader)
+ throws ServiceConfigurationError
+ {
+ return new LazyIterator(service, loader);
+ }
+
+
+ /**
+ * Locates and incrementally instantiates the available providers of a
+ * given service using the context class loader. This convenience method
+ * is equivalent to
+ *
+ * <pre>
+ * ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ * return Service.providers(service, cl);
+ * </pre>
+ *
+ * @param service
+ * The service's abstract service class
+ *
+ * @return An <tt>Iterator</tt> that yields provider objects for the given
+ * service, in some arbitrary order. The iterator will throw a
+ * <tt>ServiceConfigurationError</tt> if a provider-configuration
+ * file violates the specified format or if a provider class cannot
+ * be found and instantiated.
+ *
+ * @throws ServiceConfigurationError
+ * If a provider-configuration file violates the specified format
+ * or names a provider class that cannot be found and instantiated
+ *
+ * @see #providers(java.lang.Class, java.lang.ClassLoader)
+ */
+ public static Iterator providers(Class service)
+ throws ServiceConfigurationError
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ return Service.providers(service, cl);
+ }
+
+
+ /**
+ * Locates and incrementally instantiates the available providers of a
+ * given service using the extension class loader. This convenience method
+ * simply locates the extension class loader, call it
+ * <tt>extClassLoader</tt>, and then does
+ *
+ * <pre>
+ * return Service.providers(service, extClassLoader);
+ * </pre>
+ *
+ * If the extension class loader cannot be found then the system class
+ * loader is used; if there is no system class loader then the bootstrap
+ * class loader is used.
+ *
+ * @param service
+ * The service's abstract service class
+ *
+ * @return An <tt>Iterator</tt> that yields provider objects for the given
+ * service, in some arbitrary order. The iterator will throw a
+ * <tt>ServiceConfigurationError</tt> if a provider-configuration
+ * file violates the specified format or if a provider class cannot
+ * be found and instantiated.
+ *
+ * @throws ServiceConfigurationError
+ * If a provider-configuration file violates the specified format
+ * or names a provider class that cannot be found and instantiated
+ *
+ * @see #providers(java.lang.Class, java.lang.ClassLoader)
+ */
+ public static Iterator installedProviders(Class service)
+ throws ServiceConfigurationError
+ {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ ClassLoader prev = null;
+ while (cl != null) {
+ prev = cl;
+ cl = cl.getParent();
+ }
+ return Service.providers(service, prev);
+ }
+
+}
Added: trunk/core/src/openjdk/sun/sun/misc/ServiceConfigurationError.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/misc/ServiceConfigurationError.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/misc/ServiceConfigurationError.java 2007-05-17 20:40:30 UTC (rev 3221)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 1999-2000 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.misc;
+
+
+/**
+ * Error thrown when something goes wrong while looking up service providers.
+ * In particular, this error will be thrown in the following situations:
+ *
+ * <ul>
+ * <li> A concrete provider class cannot be found,
+ * <li> A concrete provider class cannot be instantiated,
+ * <li> The format of a provider-configuration file is illegal, or
+ * <li> An IOException occurs while reading a provider-configuration file.
+ * </ul>
+ *
+ * @author Mark Reinhold
+ * @version 1.14, 07/05/05
+ * @since 1.3
+ */
+
+public class ServiceConfigurationError extends Error {
+
+ /**
+ * Constructs a new instance with the specified detail string.
+ */
+ public ServiceConfigurationError(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs a new instance that wraps the specified throwable.
+ */
+ public ServiceConfigurationError(Throwable x) {
+ super(x);
+ }
+
+}
Added: trunk/core/src/openjdk/sun/sun/reflect/Reflection.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/reflect/Reflection.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/reflect/Reflection.java 2007-05-17 20:40:30 UTC (rev 3221)
@@ -0,0 +1,325 @@
+/*
+ * Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.reflect;
+
+import java.lang.reflect.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/** Common utility routines used by both java.lang and
+ java.lang.reflect */
+
+public class Reflection {
+
+ /** Used to filter out fields and methods from certain classes from public
+ view, where they are sensitive or they may contain VM-internal objects.
+ These Maps are updated very rarely. Rather than synchronize on
+ each access, we use copy-on-write */
+ private static volatile Map<Class,String[]> fieldFilterMap;
+ private static volatile Map<Class,String[]> methodFilterMap;
+
+ static {
+ Map<Class,String[]> map = new HashMap<Class,String[]>();
+ map.put(Reflection.class,
+ new String[] {"fieldFilterMap", "methodFilterMap"});
+ map.put(System.class, new String[] {"security"});
+ fieldFilterMap = map;
+
+ methodFilterMap = new HashMap<Class,String[]>();
+ }
+
+ /** Returns the class of the method <code>realFramesToSkip</code>
+ frames up the stack (zero-based), ignoring frames associated
+ with java.lang.reflect.Method.invoke() and its implementation.
+ The first frame is that associated with this method, so
+ <code>getCallerClass(0)</code> returns the Class object for
+ sun.reflect.Reflection. Frames associated with
+ java.lang.reflect.Method.invoke() and its implementation are
+ completely ignored and do not count toward the number of "real"
+ frames skipped. */
+ public static native Class getCallerClass(int realFramesToSkip);
+
+ /** Retrieves the access flags written to the class file. For
+ inner classes these flags may differ from those returned by
+ Class.getModifiers(), which searches the InnerClasses
+ attribute to find the source-level access flags. This is used
+ instead of Class.getModifiers() for run-time access checks due
+ to compatibility reasons; see 4471811. Only the values of the
+ low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
+ valid. */
+ private static native int getClassAccessFlags(Class c);
+
+ /** A quick "fast-path" check to try to avoid getCallerClass()
+ calls. */
+ public static boolean quickCheckMemberAccess(Class memberClass,
+ int modifiers)
+ {
+ return Modifier.isPublic(getClassAccessFlags(memberClass) & modifiers);
+ }
+
+ public static void ensureMemberAccess(Class currentClass,
+ Class memberClass,
+ Object target,
+ int modifiers)
+ throws IllegalAccessException
+ {
+ if (currentClass == null || memberClass == null) {
+ throw new InternalError();
+ }
+
+ if (!verifyMemberAccess(currentClass, memberClass, target, modifiers)) {
+ throw new IllegalAccessException("Class " + currentClass.getName() +
+ " can not access a member of class " +
+ memberClass.getName() +
+ " with modifiers \"" +
+ Modifier.toString(modifiers) +
+ "\"");
+ }
+ }
+
+ public static boolean verifyMemberAccess(Class currentClass,
+ // Declaring class of field
+ // or method
+ Class memberClass,
+ // May be NULL in case of statics
+ Object target,
+ int modifiers)
+ {
+ // Verify that currentClass can access a field, method, or
+ // constructor of memberClass, where that member's access bits are
+ // "modifiers".
+
+ boolean gotIsSameClassPackage = false;
+ boolean isSameClassPackage = false;
+
+ if (currentClass == memberClass) {
+ // Always succeeds
+ return true;
+ }
+
+ if (!Modifier.isPublic(getClassAccessFlags(memberClass))) {
+ isSameClassPackage = isSameClassPackage(currentClass, memberClass);
+ gotIsSameClassPackage = true;
+ if (!isSameClassPackage) {
+ return false;
+ }
+ }
+
+ // At this point we know that currentClass can access memberClass.
+
+ if (Modifier.isPublic(modifiers)) {
+ return true;
+ }
+
+ boolean successSoFar = false;
+
+ if (Modifier.isProtected(modifiers)) {
+ // See if currentClass is a subclass of memberClass
+ if (isSubclassOf(currentClass, memberClass)) {
+ successSoFar = true;
+ }
+ }
+
+ if (!successSoFar && !Modifier.isPrivate(modifiers)) {
+ if (!gotIsSameClassPackage) {
+ isSameClassPackage = isSameClassPackage(currentClass,
+ memberClass);
+ gotIsSameClassPackage = true;
+ }
+
+ if (isSameClassPackage) {
+ successSoFar = true;
+ }
+ }
+
+ if (!successSoFar) {
+ return false;
+ }
+
+ if (Modifier.isProtected(modifiers)) {
+ // Additional test for protected members: JLS 6.6.2
+ Class targetClass = (target == null ? memberClass : target.getClass());
+ if (targetClass != currentClass) {
+ if (!gotIsSameClassPackage) {
+ isSameClassPackage = isSameClassPackage(currentClass, memberClass);
+ gotIsSameClassPackage = true;
+ }
+ if (!isSameClassPackage) {
+ if (!isSubclassOf(targetClass, currentClass)) {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private static boolean isSameClassPackage(Class c1, Class c2) {
+ return isSameClassPackage(c1.getClassLoader(), c1.getName(),
+ c2.getClassLoader(), c2.getName());
+ }
+
+ /** Returns true if two classes are in the same package; classloader
+ and classname information is enough to determine a class's package */
+ private static boolean isSameClassPackage(ClassLoader loader1, String name1,
+ ClassLoader loader2, String name2)
+ {
+ if (loader1 != loader2) {
+ return false;
+ } else {
+ int lastDot1 = name1.lastIndexOf('.');
+ int lastDot2 = name2.lastIndexOf('.');
+ if ((lastDot1 == -1) || (lastDot2 == -1)) {
+ // One of the two doesn't have a package. Only return true
+ // if the other one also doesn't have a package.
+ return (lastDot1 == lastDot2);
+ } else {
+ int idx1 = 0;
+ int idx2 = 0;
+
+ // Skip over '['s
+ if (name1.charAt(idx1) == '[') {
+ do {
+ idx1++;
+ } while (name1.charAt(idx1) == '[');
+ if (name1.charAt(idx1) != 'L') {
+ // Something is terribly wrong. Shouldn't be here.
+ throw new InternalError("Illegal class name " + name1);
+ }
+ }
+ if (name2.charAt(idx2) == '[') {
+ do {
+ idx2++;
+ } while (name2.charAt(idx2) == '[');
+ if (name2.charAt(idx2) != 'L') {
+ // Something is terribly wrong. Shouldn't be here.
+ throw new InternalError("Illegal class name " + name2);
+ }
+ }
+
+ // Check that package part is identical
+ int length1 = lastDot1 - idx1;
+ int length2 = lastDot2 - idx2;
+
+ if (length1 != length2) {
+ return false;
+ }
+ return name1.regionMatches(false, idx1, name2, idx2, length1);
+ }
+ }
+ }
+
+ static boolean isSubclassOf(Class queryClass,
+ Class ofClass)
+ {
+ while (queryClass != null) {
+ if (queryClass == ofClass) {
+ return true;
+ }
+ queryClass = queryClass.getSuperclass();
+ }
+ return false;
+ }
+
+ // fieldNames must contain only interned Strings
+ public static synchronized void registerFieldsToFilter(Class containingClass,
+ String ... fieldNames) {
+ fieldFilterMap =
+ registerFilter(fieldFilterMap, containingClass, fieldNames);
+ }
+
+ // methodNames must contain only interned Strings
+ public static synchronized void registerMethodsToFilter(Class containingClass,
+ String ... methodNames) {
+ methodFilterMap =
+ registerFilter(methodFilterMap, containingClass, methodNames);
+ }
+
+ private static Map<Class,String[]> registerFilter(Map<Class,String[]> map,
+ Class containingClass, String ... names) {
+ if (map.get(containingClass) != null) {
+ throw new IllegalArgumentException
+ ("Filter already registered: " + containingClass);
+ }
+ map = new HashMap<Class,String[]>(map);
+ map.put(containingClass, names);
+ return map;
+ }
+
+ public static Field[] filterFields(Class containingClass,
+ Field[] fields) {
+ if (fieldFilterMap == null) {
+ // Bootstrapping
+ return fields;
+ }
+ return (Field[])filter(fields, fieldFilterMap.get(containingClass));
+ }
+
+ public static Method[] filterMethods(Class containingClass, Method[] methods) {
+ if (methodFilterMap == null) {
+ // Bootstrapping
+ return methods;
+ }
+ return (Method[])filter(methods, methodFilterMap.get(containingClass));
+ }
+
+ private static Member[] filter(Member[] members, String[] filteredNames) {
+ if ((filteredNames == null) || (members.length == 0)) {
+ return members;
+ }
+ int numNewMembers = 0;
+ for (Member member : members) {
+ boolean shouldSkip = false;
+ for (String filteredName : filteredNames) {
+ if (member.getName() == filteredName) {
+ shouldSkip = true;
+ break;
+ }
+ }
+ if (!shouldSkip) {
+ ++numNewMembers;
+ }
+ }
+ Member[] newMembers =
+ (Member[])Array.newInstance(members[0].getClass(), numNewMembers);
+ int destIdx = 0;
+ for (Member member : members) {
+ boolean shouldSkip = false;
+ for (String filteredName : filteredNames) {
+ if (member.getName() == filteredName) {
+ shouldSkip = true;
+ break;
+ }
+ }
+ if (!shouldSkip) {
+ newMembers[destIdx++] = member;
+ }
+ }
+ return newMembers;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/security/util/SecurityConstants.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/security/util/SecurityConstants.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/security/util/SecurityConstants.java 2007-05-17 20:40:30 UTC (rev 3221)
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.security.util;
+
+import java.io.FilePermission;
+import java.awt.AWTPermission;
+import java.util.PropertyPermission;
+import java.lang.RuntimePermission;
+import java.net.SocketPermission;
+import java.net.NetPermission;
+import java.security.SecurityPermission;
+import java.security.AllPermission;
+import javax.security.auth.AuthPermission;
+
+/**
+ * Permission constants and string constants used to create permissions
+ * used throughout the JDK.
+ */
+public final class SecurityConstants {
+ // Cannot create one of these
+ private SecurityConstants () {
+ }
+
+ // Commonly used string constants for permission actions used by
+ // SecurityManager. Declare here for shortcut when checking permissions
+ // in FilePermission, SocketPermission, and PropertyPermission.
+
+ public static final String FILE_DELETE_ACTION = "delete";
+ public static final String FILE_EXECUTE_ACTION = "execute";
+ public static final String FILE_READ_ACTION = "read";
+ public static final String FILE_WRITE_ACTION = "write";
+
+ public static final String SOCKET_RESOLVE_ACTION = "resolve";
+ public static final String SOCKET_CONNECT_ACTION = "connect";
+ public static final String SOCKET_LISTEN_ACTION = "listen";
+ public static final String SOCKET_ACCEPT_ACTION = "accept";
+ public static final String SOCKET_CONNECT_ACCEPT_ACTION = "connect,accept";
+
+ public static final String PROPERTY_RW_ACTION = "read,write";
+ public static final String PROPERTY_READ_ACTION = "read";
+ public static final String PROPERTY_WRITE_ACTION = "write";
+
+ // Permission constants used in the various checkPermission() calls in JDK.
+
+ // java.lang.Class, java.lang.SecurityManager, java.lang.System,
+ // java.net.URLConnection, java.security.AllPermission, java.security.Policy,
+ // sun.security.provider.PolicyFile
+ public static final AllPermission ALL_PERMISSION = new AllPermission();
+
+ // java.lang.SecurityManager
+ public static final AWTPermission TOPLEVEL_WINDOW_PERMISSION =
+ new AWTPermission("showWindowWithoutWarningBanner");
+
+ // java.lang.SecurityManager
+ public static final AWTPermission ACCESS_CLIPBOARD_PERMISSION =
+ new AWTPermission("accessClipboard");
+
+ // java.lang.SecurityManager
+ public static final AWTPermission CHECK_AWT_EVENTQUEUE_PERMISSION =
+ new AWTPermission("accessEventQueue");
+
+ // java.awt.Dialog
+ public static final AWTPermission TOOLKIT_MODALITY_PERMISSION =
+ new AWTPermission("toolkitModality");
+
+ // java.awt.Robot
+ public static final AWTPermission READ_DISPLAY_PIXELS_PERMISSION =
+ new AWTPermission("readDisplayPixels");
+
+ // java.awt.Robot
+ public static final AWTPermission CREATE_ROBOT_PERMISSION =
+ new AWTPermission("createRobot");
+
+ // java.awt.MouseInfo
+ public static final AWTPermission WATCH_MOUSE_PERMISSION =
+ new AWTPermission("watchMousePointer");
+
+ // java.awt.Window
+ public static final AWTPermission SET_WINDOW_ALWAYS_ON_TOP_PERMISSION =
+ new AWTPermission("setWindowAlwaysOnTop");
+
+ // java.awt.Toolkit
+ public static final AWTPermission ALL_AWT_EVENTS_PERMISSION =
+ new AWTPermission("listenToAllAWTEvents");
+
+ // java.awt.SystemTray
+ public static final AWTPermission ACCESS_SYSTEM_TRAY_PERMISSION =
+ new AWTPermission("accessSystemTray");
+
+ // java.net.URL
+ public static final NetPermission SPECIFY_HANDLER_PERMISSION =
+ new NetPermission("specifyStreamHandler");
+
+ // java.net.ProxySelector
+ public static final NetPermission SET_PROXYSELECTOR_PERMISSION =
+ new NetPermission("setProxySelector");
+
+ // java.net.ProxySelector
+ public static final NetPermission GET_PROXYSELECTOR_PERMISSION =
+ new NetPermission("getProxySelector");
+
+ // java.net.CookieHandler
+ public static final NetPermission SET_COOKIEHANDLER_PERMISSION =
+ new NetPermission("setCookieHandler");
+
+ // java.net.CookieHandler
+ public static final NetPermission GET_COOKIEHANDLER_PERMISSION =
+ new NetPermission("getCookieHandler");
+
+ // java.net.ResponseCache
+ public static final NetPermission SET_RESPONSECACHE_PERMISSION =
+ new NetPermission("setResponseCache");
+
+ // java.net.ResponseCache
+ public static final NetPermission GET_RESPONSECACHE_PERMISSION =
+ new NetPermission("getResponseCache");
+
+ // java.lang.SecurityManager, sun.applet.AppletPanel, sun.misc.Launcher
+ public static final RuntimePermission CREATE_CLASSLOADER_PERMISSION =
+ new RuntimePermission("createClassLoader");
+
+ // java.lang.SecurityManager
+ public static final RuntimePermission CHECK_MEMBER_ACCESS_PERMISSION =
+ new RuntimePermission("accessDeclaredMembers");
+
+ // java.lang.SecurityManager, sun.applet.AppletSecurity
+ public static final RuntimePermission MODIFY_THREAD_PERMISSION =
+ new RuntimePermission("modifyThread");
+
+ // java.lang.SecurityManager, sun.applet.AppletSecurity
+ public static final RuntimePermission MODIFY_THREADGROUP_PERMISSION =
+ new RuntimePermission("modifyThreadGroup");
+
+ // java.lang.Class
+ public static final RuntimePermission GET_PD_PERMISSION =
+ new RuntimePermission("getProtectionDomain");
+
+ // java.lang.Class, java.lang.ClassLoader, java.lang.Thread
+ public static final RuntimePermission GET_CLASSLOADER_PERMISSION =
+ new RuntimePermission("getClassLoader");
+
+ // java.lang.Thread
+ public static final RuntimePermission STOP_THREAD_PERMISSION =
+ new RuntimePermission("stopThread");
+
+ // java.lang.Thread
+ public static final RuntimePermission GET_STACK_TRACE_PERMISSION =
+ new RuntimePermission("getStackTrace");
+
+ // java.security.AccessControlContext
+ public static final SecurityPermission CREATE_ACC_PERMISSION =
+ new SecurityPermission("createAccessControlContext");
+
+ // java.security.AccessControlContext
+ public static final SecurityPermission GET_COMBINER_PERMISSION =
+ new SecurityPermission("getDomainCombiner");
+
+ // java.security.Policy, java.security.ProtectionDomain
+ public static final SecurityPermission GET_POLICY_PERMISSION =
+ new SecurityPermission ("getPolicy");
+
+ // java.lang.SecurityManager
+ public static final SocketPermission LOCAL_LISTEN_PERMISSION =
+ new SocketPermission("localhost:1024-", SOCKET_LISTEN_ACTION);
+
+ // javax.security.auth.Subject
+ public static final AuthPermission DO_AS_PERMISSION =
+ new AuthPermission("doAs");
+
+ // javax.security.auth.Subject
+ public static final AuthPermission DO_AS_PRIVILEGED_PERMISSION =
+ new AuthPermission("doAsPrivileged");
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-17 20:39:06
|
Revision: 3220
http://jnode.svn.sourceforge.net/jnode/?rev=3220&view=rev
Author: lsantha
Date: 2007-05-17 13:38:58 -0700 (Thu, 17 May 2007)
Log Message:
-----------
Openjdk patches.
Added Paths:
-----------
trunk/core/src/openjdk/vm/sun/
trunk/core/src/openjdk/vm/sun/reflect/
trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java
Added: trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java
===================================================================
--- trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java (rev 0)
+++ trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java 2007-05-17 20:38:58 UTC (rev 3220)
@@ -0,0 +1,35 @@
+/*
+ * $Id$
+ */
+package sun.reflect;
+
+import org.jnode.vm.VmSystem;
+
+/**
+ * @see sun.reflect.Reflection
+ * @author Levente S\xE1ntha
+ */
+class NativeReflection {
+ /**
+ *
+ * @param realFramesToSkip
+ * @return
+ * @see Reflection#getCallerClass(int)
+ */
+ static Class getCallerClass(int realFramesToSkip){
+ //todo test it
+ return VmSystem.getClassContext()[realFramesToSkip];
+ }
+
+ /**
+ *
+ * @param c
+ * @return
+ * @see Reflection#getClassAccessFlags(Class)
+ */
+ static int getClassAccessFlags(Class c) {
+ //todo implement it
+ throw new UnsupportedOperationException();
+ }
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|