You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by lv...@apache.org on 2010/09/20 07:35:56 UTC
svn commit: r998786 - in
/harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang:
./ model/ model/SourceVersion.java model/UnknownEntityException.java
Author: lvjing
Date: Mon Sep 20 05:35:55 2010
New Revision: 998786
URL: http://svn.apache.org/viewvc?rev=998786&view=rev
Log:
add all annotation processing source
Added:
harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/
harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/
harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/SourceVersion.java (with props)
harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/UnknownEntityException.java (with props)
Added: harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/SourceVersion.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/SourceVersion.java?rev=998786&view=auto
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/SourceVersion.java (added)
+++ harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/SourceVersion.java Mon Sep 20 05:35:55 2010
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.lang.model;
+
+import java.util.HashSet;
+
+public enum SourceVersion {
+ RELEASE_0, RELEASE_1, RELEASE_2, RELEASE_3, RELEASE_4, RELEASE_5, RELEASE_6;
+
+ static String[] keywordList = { "abstract", "else", "interface", "super",
+ "boolean", "extends", "long", "switch", "break", "final", "native",
+ "synchronized", "byte", "finally", "new", "this", "case", "float",
+ "package", "throw", "catch", "for", "private", "throws", "char",
+ "if", "protected", "transient", "class", "implements", "public",
+ "try", "continue", "import", "return", "void", "default",
+ "instanceof", "short", "volatile", "do", "int", "static", "while",
+ "double" };
+
+ static HashSet<String> keywords;
+
+ static {
+ keywords = new HashSet<String>();
+ for (int i = 0; i < keywordList.length; i++) {
+ keywords.add(keywordList[i]);
+ }
+ }
+
+ public static boolean isIdentifier(CharSequence name) {
+ if (!Character.isJavaIdentifierStart(name.charAt(0))) {
+ return false;
+ }
+ for (int i = 1; i < name.length(); i++) {
+ if (!Character.isJavaIdentifierPart(name.charAt(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean isKeyword(CharSequence s) {
+ return keywords.contains(s.toString());
+ }
+
+ public static boolean isName(CharSequence name) {
+ char first = name.charAt(0);
+ if (first == '.' || first == ')' || first == '('){
+ return false;
+ }
+ String[] lists = name.toString().split(".");
+ for (int i = 0; i < lists.length; i++) {
+ if (isKeyword(name)){
+ System.out.println("iskey");
+ return false;
+ }
+ if(!isIdentifier(name)){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static SourceVersion latest() {
+ return RELEASE_6;
+ }
+
+ public static SourceVersion latestSupported() {
+ return RELEASE_6;
+ }
+
+}
\ No newline at end of file
Propchange: harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/SourceVersion.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/UnknownEntityException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/UnknownEntityException.java?rev=998786&view=auto
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/UnknownEntityException.java (added)
+++ harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/UnknownEntityException.java Mon Sep 20 05:35:55 2010
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package javax.lang.model;
+
+public class UnknownEntityException extends RuntimeException {
+ protected UnknownEntityException(String message) {
+ super(message);
+ }
+
+}
Propchange: harmony/enhanced/java/branches/java6/classlib/modules/annotation/src/main/java/javax/lang/model/UnknownEntityException.java
------------------------------------------------------------------------------
svn:eol-style = native