You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by th...@apache.org on 2014/12/21 20:56:34 UTC
[08/35] tapestry-5 git commit: Second pass creating the BeanModel and
Commons packages.
Second pass creating the BeanModel and Commons packages.
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1f36bb20
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1f36bb20
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1f36bb20
Branch: refs/heads/master
Commit: 1f36bb203cb0646f912125caa3bd03707aa95083
Parents: f963c7a
Author: Thiago H. de Paula Figueiredo <th...@apache.org>
Authored: Sat Dec 6 16:40:55 2014 -0200
Committer: Thiago H. de Paula Figueiredo <th...@apache.org>
Committed: Sat Dec 6 16:40:55 2014 -0200
----------------------------------------------------------------------
.../internal/antlr/PropertyExpressionLexer.g | 163 +++++++++++++++++
.../internal/antlr/PropertyExpressionParser.g | 105 +++++++++++
.../tapestry5/internal/antlr/BaseLexer.java | 54 ++++++
.../tapestry5/internal/antlr/BaseParser.java | 40 +++++
.../tapestry5/internal/antlr/package-info.java | 18 ++
.../tapestry5/internal/services/Invariant.java | 28 +++
.../services/LiteralPropertyConduit.java | 85 +++++++++
.../services/PropertyExpressionException.java | 38 ++++
.../internal/services/StringInterner.java | 43 +++++
.../org/apache/tapestry5/ioc/ObjectCreator.java | 27 +++
.../ioc/services/PlasticProxyFactory.java | 159 +++++++++++++++++
.../org/apache/tapestry5/ioc/util/Stack.java | 173 +++++++++++++++++++
.../internal/antlr/PropertyExpressionLexer.g | 163 -----------------
.../internal/antlr/PropertyExpressionParser.g | 105 -----------
.../tapestry5/internal/antlr/BaseLexer.java | 54 ------
.../tapestry5/internal/antlr/BaseParser.java | 40 -----
.../tapestry5/internal/antlr/package-info.java | 18 --
.../tapestry5/internal/services/Invariant.java | 28 ---
.../services/LiteralPropertyConduit.java | 85 ---------
.../services/PropertyExpressionException.java | 38 ----
.../internal/services/StringInterner.java | 43 -----
.../org/apache/tapestry5/ioc/ObjectCreator.java | 27 ---
.../ioc/annotations/IncompatibleChange.java | 33 ----
.../ioc/services/PlasticProxyFactory.java | 159 -----------------
.../org/apache/tapestry5/ioc/util/Stack.java | 173 -------------------
.../ioc/annotations/IncompatibleChange.java | 33 ++++
26 files changed, 966 insertions(+), 966 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/beanmodel/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g b/beanmodel/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
new file mode 100644
index 0000000..3b52ba9
--- /dev/null
+++ b/beanmodel/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
@@ -0,0 +1,163 @@
+// Copyright 2008, 2010, 2011 The Apache Software Foundation
+//
+// Licensed 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.
+
+lexer grammar PropertyExpressionLexer;
+
+
+options
+{
+ superClass='org.apache.tapestry5.internal.antlr.BaseLexer';
+}
+
+@header
+{
+package org.apache.tapestry5.internal.antlr;
+}
+
+
+// Integer constant
+fragment INTEGER
+ : {this.getClass(); /* Fix java.lang.VerifyError: Stack size too large */};
+
+// Read a property or invoke a method.
+fragment DEREF
+ : {this.getClass(); /* Fix java.lang.VerifyError: Stack size too large */};
+
+// Range operator, ".." between two integers.
+fragment RANGEOP
+ : {this.getClass(); /* Fix java.lang.VerifyError: Stack size too large */};
+
+// Decimal number
+fragment DECIMAL
+ : {this.getClass(); /* Fix java.lang.VerifyError: Stack size too large */};
+
+fragment LETTER
+ : ('a'..'z'|'A'..'Z');
+fragment DIGIT
+ : '0'..'9';
+fragment SIGN
+ : ('+'|'-');
+LPAREN : '(';
+RPAREN : ')';
+LBRACKET: '[';
+RBRACKET: ']';
+COMMA : ',';
+BANG : '!';
+LBRACE : '{';
+RBRACE : '}';
+COLON : ':';
+
+fragment QUOTE
+ : '\'';
+
+// Clumsy but effective approach to case-insensitive identifiers.
+
+fragment A
+ : ('a' | 'A');
+fragment E
+ : ('e' | 'E');
+fragment F
+ : ('f' | 'F');
+fragment H
+ : ('h' | 'H');
+fragment I
+ : ('i' | 'I');
+fragment L
+ : ('l' | 'L');
+fragment N
+ : ('n'|'N');
+fragment R
+ : ('r' | 'R');
+fragment S
+ : ('s' | 'S');
+fragment T
+ : ('t' | 'T');
+fragment U
+ : ('u' | 'U');
+
+// Identifiers are case insensitive
+
+NULL : N U L L;
+TRUE : T R U E;
+FALSE : F A L S E;
+THIS : T H I S;
+
+IDENTIFIER
+ : JAVA_ID_START (JAVA_ID_PART)*
+ ;
+
+fragment
+JAVA_ID_START
+ : '\u0024'
+ | '\u0041'..'\u005a'
+ | '\u005f'
+ | '\u0061'..'\u007a'
+ | '\u00c0'..'\u00d6'
+ | '\u00d8'..'\u00f6'
+ | '\u00f8'..'\u00ff'
+ | '\u0100'..'\u1fff'
+ | '\u3040'..'\u318f'
+ | '\u3300'..'\u337f'
+ | '\u3400'..'\u3d2d'
+ | '\u4e00'..'\u9fff'
+ | '\uf900'..'\ufaff'
+ ;
+
+fragment
+JAVA_ID_PART
+ : JAVA_ID_START
+ | '\u0030'..'\u0039'
+ ;
+
+
+// The Safe Dereference operator understands not to de-reference through
+// a null.
+
+SAFEDEREF
+ : '?.';
+
+WS : (' '|'\t'|'\n'|'\r')+ { skip(); };
+
+
+// Literal strings are always inside single quotes.
+STRING
+ : QUOTE (options {greedy=false;} : .)* QUOTE { setText(getText().substring(1, getText().length()-1)); };
+
+
+// Special rule that uses parsing tricks to identify numbers and ranges; it's all about
+// the dot ('.').
+// Recognizes:
+// '.' as DEREF
+// '..' as RANGEOP
+// INTEGER (sign? digit+)
+// DECIMAL (sign? digits* . digits+)
+// Has to watch out for embedded rangeop (i.e. "1..10" is not "1." and ".10").
+
+NUMBER_OR_RANGEOP
+ : SIGN? DIGIT+
+ (
+ { input.LA(2) != '.' }? => '.' DIGIT* { $type = DECIMAL; stripLeadingPlus(); }
+ | { $type = INTEGER; stripLeadingPlus(); }
+ )
+
+ | SIGN '.' DIGIT+ { $type = DECIMAL; stripLeadingPlus(); }
+
+ | '.'
+ (
+ DIGIT+ { $type = DECIMAL; stripLeadingPlus();}
+ | '.' {$type = RANGEOP; }
+ | {$type = DEREF; }
+ )
+ ;
+
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/beanmodel/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g b/beanmodel/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
new file mode 100644
index 0000000..14753e6
--- /dev/null
+++ b/beanmodel/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
@@ -0,0 +1,105 @@
+// Copyright 2008, 2009, 2011 The Apache Software Foundation
+//
+// Licensed 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.
+
+parser grammar PropertyExpressionParser;
+
+
+options
+{
+ superClass='org.apache.tapestry5.internal.antlr.BaseParser';
+ output=AST;
+ ASTLabelType=CommonTree;
+ tokenVocab=PropertyExpressionLexer;
+ backtrack=true;
+}
+
+tokens
+{
+ // Parser token representing a method invocation
+ INVOKE;
+ // A List (top level, or as method parameter)
+ LIST;
+ //A Map (top level, or as method parameter)
+ MAP;
+ // Not operation (invert a boolean)
+ NOT;
+}
+
+@header
+{
+package org.apache.tapestry5.internal.antlr;
+}
+
+
+start : expression^ EOF!;
+
+expression
+ : keyword
+ | rangeOp
+ | constant
+ | propertyChain
+ | list
+ | notOp
+ | map
+ ;
+
+keyword : NULL | TRUE | FALSE | THIS;
+
+constant: INTEGER| DECIMAL | STRING;
+
+propertyChain
+ : term DEREF propertyChain -> ^(DEREF term propertyChain)
+ | term SAFEDEREF propertyChain -> ^(SAFEDEREF term propertyChain)
+ | term
+ ;
+
+term : IDENTIFIER
+ | methodInvocation
+ ;
+
+methodInvocation
+ : id=IDENTIFIER LPAREN RPAREN -> ^(INVOKE $id)
+ | id=IDENTIFIER LPAREN expressionList RPAREN -> ^(INVOKE $id expressionList)
+ ;
+
+expressionList
+ : expression (COMMA! expression)*
+ ;
+
+rangeOp
+ : from=rangeopArg RANGEOP to=rangeopArg -> ^(RANGEOP $from $to)
+ ;
+
+rangeopArg
+ : INTEGER
+ | propertyChain
+ ;
+
+list : LBRACKET RBRACKET -> ^(LIST)
+ | LBRACKET expressionList RBRACKET -> ^(LIST expressionList)
+ ;
+
+notOp : BANG expression -> ^(NOT expression)
+ ;
+
+map : LBRACE RBRACE -> ^(MAP)
+ | LBRACE mapEntryList RBRACE -> ^(MAP mapEntryList)
+ ;
+
+mapEntryList : mapEntry (COMMA! mapEntry)*;
+
+mapEntry : mapKey COLON! expression;
+
+mapKey : keyword | constant | propertyChain;
+
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/BaseLexer.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/BaseLexer.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/BaseLexer.java
new file mode 100644
index 0000000..442240d
--- /dev/null
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/BaseLexer.java
@@ -0,0 +1,54 @@
+// Copyright 2008, 2009 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.internal.antlr;
+
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.Lexer;
+import org.antlr.runtime.RecognizerSharedState;
+import org.antlr.runtime.RecognitionException;
+
+public abstract class BaseLexer extends Lexer
+{
+ protected BaseLexer()
+ {
+ }
+
+ protected BaseLexer(CharStream charStream,
+ RecognizerSharedState recognizerSharedState)
+ {
+ super(charStream, recognizerSharedState);
+ }
+
+ protected void stripLeadingPlus()
+ {
+ String text = getText();
+
+ // For compatibility with Tapestry 5.0, we need to allow a sign of '+', which Long.parseLong()
+ // doesn't accept. To keep things downstream simple, we eliminate the '+' here.
+
+ if (text.startsWith("+"))
+ {
+ setText(text.substring(1));
+ }
+ }
+
+ @Override
+ public void reportError(RecognitionException e)
+ {
+ throw new RuntimeException(String.format("Unable to parse input at character position %d",
+ e.charPositionInLine + 1),
+ e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/BaseParser.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/BaseParser.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/BaseParser.java
new file mode 100644
index 0000000..212b782
--- /dev/null
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/BaseParser.java
@@ -0,0 +1,40 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.internal.antlr;
+
+import org.antlr.runtime.Parser;
+import org.antlr.runtime.TokenStream;
+import org.antlr.runtime.RecognizerSharedState;
+
+public class BaseParser extends Parser
+{
+ public BaseParser(TokenStream tokenStream)
+ {
+ super(tokenStream);
+ }
+
+ public BaseParser(TokenStream tokenStream,
+ RecognizerSharedState recognizerSharedState)
+ {
+ super(tokenStream, recognizerSharedState);
+ }
+
+ @Override
+ public void emitErrorMessage(String message)
+ {
+ // This is caught and more properly reported later.
+ throw new RuntimeException(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/package-info.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/package-info.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/package-info.java
new file mode 100644
index 0000000..55be313
--- /dev/null
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/antlr/package-info.java
@@ -0,0 +1,18 @@
+// Copyright 2012 The Apache Software Foundation
+//
+// Licensed 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.
+
+/**
+ * [INTERNAL USE ONLY] support classes related to Antlr; API subject to change
+ */
+package org.apache.tapestry5.internal.antlr;
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/beanmodel/src/main/java/org/apache/tapestry5/internal/services/Invariant.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/Invariant.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/Invariant.java
new file mode 100644
index 0000000..924b570
--- /dev/null
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/Invariant.java
@@ -0,0 +1,28 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.internal.services;
+
+import java.lang.annotation.*;
+
+/**
+ * Special annotation that is applied to literal {@link org.apache.tapestry5.PropertyConduit}s, to inform {@link
+ * org.apache.tapestry5.internal.bindings.PropBinding} that the value is, in fact, invariant.
+ */
+@Target({ElementType.PARAMETER, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Invariant
+{
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
new file mode 100644
index 0000000..1fffd4f
--- /dev/null
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
@@ -0,0 +1,85 @@
+// Copyright 2008, 2011 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.internal.services;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import org.apache.tapestry5.internal.InternalPropertyConduit;
+import org.apache.tapestry5.ioc.AnnotationProvider;
+import org.apache.tapestry5.ioc.services.TypeCoercer;
+
+/**
+ * A PropertyConduit for a literal value in an expression, such as a number, or "true", "false" or "null".
+ */
+public class LiteralPropertyConduit extends PropertyConduitDelegate implements InternalPropertyConduit
+{
+ private final Class propertyType;
+
+ private final AnnotationProvider annotationProvider;
+
+ private final String description;
+
+ private final Object value;
+
+ public LiteralPropertyConduit(TypeCoercer typeCoercer, Class propertyType, AnnotationProvider annotationProvider,
+ String description, Object value)
+ {
+ super(typeCoercer);
+
+ this.propertyType = propertyType;
+ this.annotationProvider = annotationProvider;
+ this.description = description;
+
+ this.value = value;
+ }
+
+ public Object get(Object instance)
+ {
+ return value;
+ }
+
+ public void set(Object instance, Object value)
+ {
+ throw new RuntimeException("Literal values are not updateable.");
+ }
+
+ public Class getPropertyType()
+ {
+ return propertyType;
+ }
+
+ public Type getPropertyGenericType()
+ {
+ return propertyType;
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+ {
+ return annotationProvider.getAnnotation(annotationClass);
+ }
+
+ public String getPropertyName()
+ {
+ return null;
+ }
+
+ @Override
+ public String toString()
+ {
+ return description;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyExpressionException.java
----------------------------------------------------------------------
diff --git a/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyExpressionException.java b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyExpressionException.java
new file mode 100644
index 0000000..765c0bb
--- /dev/null
+++ b/beanmodel/src/main/java/org/apache/tapestry5/internal/services/PropertyExpressionException.java
@@ -0,0 +1,38 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.internal.services;
+
+/**
+ * Exception thrown when there is a problem parsing a property expression using the ANTLR property expression grammar.
+ */
+public class PropertyExpressionException extends RuntimeException
+{
+ private final String expression;
+
+ public PropertyExpressionException(String message, String expression, Throwable cause)
+ {
+ super(message, cause);
+
+ this.expression = expression;
+ }
+
+ /**
+ * Returns the property expression containing the error.
+ */
+ public String getExpression()
+ {
+ return expression;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/commons/src/main/java/org/apache/tapestry5/internal/services/StringInterner.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/tapestry5/internal/services/StringInterner.java b/commons/src/main/java/org/apache/tapestry5/internal/services/StringInterner.java
new file mode 100644
index 0000000..78ee5f4
--- /dev/null
+++ b/commons/src/main/java/org/apache/tapestry5/internal/services/StringInterner.java
@@ -0,0 +1,43 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.internal.services;
+
+/**
+ * Creates "interned" strings that are unique for the same content. This is used for common description strings,
+ * particularly those used by {@link org.apache.tapestry5.Binding} instances. The internal cache of interned strings id
+ * cleared whenever the {@link org.apache.tapestry5.services.ComponentClasses} {@link
+ * org.apache.tapestry5.services.InvalidationEventHub} is invalidated (i.e., when component class files change).
+ *
+ * @since 5.1.0.0
+ */
+public interface StringInterner
+{
+ /**
+ * Interns a string.
+ *
+ * @param string the string to intern
+ * @return the input string, or another string instance with the same content
+ */
+ String intern(String string);
+
+ /**
+ * Formats a string (using {@link String#format(String, Object[])}) and returns the interned result.
+ *
+ * @param format string format
+ * @param arguments used inside the format
+ * @return formatted and interned string
+ */
+ String format(String format, Object... arguments);
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/commons/src/main/java/org/apache/tapestry5/ioc/ObjectCreator.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/tapestry5/ioc/ObjectCreator.java b/commons/src/main/java/org/apache/tapestry5/ioc/ObjectCreator.java
new file mode 100644
index 0000000..e7990fc
--- /dev/null
+++ b/commons/src/main/java/org/apache/tapestry5/ioc/ObjectCreator.java
@@ -0,0 +1,27 @@
+// Copyright 2006, 2008, 2011 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.ioc;
+
+/**
+ * Interface used to encapsulate any strategy used defer the creation of some object until just as needed.
+ */
+public interface ObjectCreator<T>
+{
+ /**
+ * Create and return the object. In some limited circumstances, the implementation may cache the result, returning
+ * the same object for repeated calls.
+ */
+ T createObject();
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/commons/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java b/commons/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java
new file mode 100644
index 0000000..75e93e4
--- /dev/null
+++ b/commons/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java
@@ -0,0 +1,159 @@
+// Copyright 2011, 2012 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.ioc.services;
+
+import org.apache.tapestry5.ioc.Location;
+import org.apache.tapestry5.ioc.ObjectCreator;
+import org.apache.tapestry5.ioc.annotations.IncompatibleChange;
+import org.apache.tapestry5.plastic.ClassInstantiator;
+import org.apache.tapestry5.plastic.PlasticClassListenerHub;
+import org.apache.tapestry5.plastic.PlasticClassTransformation;
+import org.apache.tapestry5.plastic.PlasticClassTransformer;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * A service used to create proxies of varying types. As a secondary concern, manages to identify the
+ * location of methods and constructors, which is important for exception reporting.
+ *
+ * @since 5.3
+ */
+public interface PlasticProxyFactory extends PlasticClassListenerHub
+{
+ /**
+ * Returns the class loader used when creating new classes, this is a child class loader
+ * of another class loader (usually, the thread's context class loader).
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Creates a proxy object that implements the indicated interface, then invokes the callback to further
+ * configure the proxy.
+ *
+ * @param interfaceType
+ * interface implemented by proxy
+ * @param callback
+ * configures the proxy
+ * @return instantiator that can be used to create an instance of the proxy class
+ */
+ <T> ClassInstantiator<T> createProxy(Class<T> interfaceType, PlasticClassTransformer callback);
+
+ /**
+ * Creates a proxy object that implements the indicated interface and indicated service implementation type,
+ * then invokes the callback to further configure the proxy.
+ *
+ * @param interfaceType
+ * interface implemented by proxy
+ * @param implementationType
+ * a class that implements the interfaceType. It can be null.
+ * @param callback
+ * configures the proxy
+ * @return instantiator that can be used to create an instance of the proxy class
+ */
+ @IncompatibleChange(release = "5.4", details = "TAP5-2029")
+ <T> ClassInstantiator<T> createProxy(Class<T> interfaceType, Class<? extends T> implementationType, PlasticClassTransformer callback);
+
+ /**
+ * Creates the underlying {@link PlasticClassTransformation} for an interface proxy. This should only be
+ * used in the cases where encapsulating the PlasticClass construction into a {@linkplain PlasticClassTransformer
+ * callback} is not feasible (which is the case for some of the older APIs inside Tapestry IoC).
+ *
+ * @param interfaceType
+ * class proxy will extend from
+ * @return transformation from which an instantiator may be created
+ */
+ <T> PlasticClassTransformation<T> createProxyTransformation(Class<T> interfaceType);
+
+ /**
+ * Creates the underlying {@link PlasticClassTransformation} for an interface proxy with a given
+ * implementation class. This should only be
+ * used in the cases where encapsulating the PlasticClass construction into a {@linkplain PlasticClassTransformer
+ * callback} is not feasible (which is the case for some of the older APIs inside Tapestry IoC).
+ *
+ * @param interfaceType
+ * class proxy will extend from
+ * @param implementationType
+ * a class that implements the interfaceType. It can be null.
+ * @return transformation from which an instantiator may be created
+ */
+ @IncompatibleChange(release = "5.4", details = "TAP5-2029")
+ <T> PlasticClassTransformation<T> createProxyTransformation(Class<T> interfaceType, Class<? extends T> implementationType);
+
+ /**
+ * Creates a proxy instance that delegates all methods through a corresponding
+ * ObjectCreator. Each method invocation on the proxy will route through {@link ObjectCreator#createObject()} (the
+ * creator implementation may decide to
+ * cache the return value as appropriate).
+ *
+ * @param <T>
+ * type of proxy
+ * @param interfaceType
+ * interface class for proxy
+ * @param creator
+ * object responsible for creating the real object
+ * @param description
+ * the <code>toString()</code> of the proxy
+ * @return proxy instance
+ */
+ <T> T createProxy(Class<T> interfaceType, ObjectCreator<T> creator, String description);
+
+ /**
+ * Creates a proxy instance that delegates all methods through a corresponding
+ * ObjectCreator. Each method invocation on the proxy will route through {@link ObjectCreator#createObject()} (the
+ * creator implementation may decide to
+ * cache the return value as appropriate).
+ *
+ * @param <T>
+ * type of proxy
+ * @param interfaceType
+ * interface class for proxy
+ * @param implementationType
+ * class that implements the interface type. It may be null
+ * @param creator
+ * object responsible for creating the real object
+ * @param description
+ * the <code>toString()</code> of the proxy
+ * @return proxy instance
+ */
+ @IncompatibleChange(release = "5.4", details = "Added for TAP5-2029")
+ <T> T createProxy(Class<T> interfaceType, Class<? extends T> implementationType, ObjectCreator<T> creator, String description);
+
+ /**
+ * Converts a method to a {@link Location}, which includes information about the source file name and line number.
+ *
+ * @param method
+ * to look up
+ * @return the location (identifying the method and possibly, the line number within the method)
+ */
+ Location getMethodLocation(Method method);
+
+ /**
+ * Return a string representation for the constructor (including class and parameters) and (if available) file name
+ * and line number.
+ *
+ * @return the location (identifying the constructor and possibly, the line number within the method)
+ */
+ Location getConstructorLocation(Constructor constructor);
+
+ /**
+ * Clears any cached information stored by the proxy factory; this is useful in Tapestry development mode
+ * when a class loader may have been discarded (because the proxy factory may indirectly keep references
+ * to classes loaded by the old class loader).
+ *
+ * @since 5.3.3
+ */
+ void clearCache();
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/commons/src/main/java/org/apache/tapestry5/ioc/util/Stack.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/tapestry5/ioc/util/Stack.java b/commons/src/main/java/org/apache/tapestry5/ioc/util/Stack.java
new file mode 100644
index 0000000..cfa13a0
--- /dev/null
+++ b/commons/src/main/java/org/apache/tapestry5/ioc/util/Stack.java
@@ -0,0 +1,173 @@
+// Copyright 2007, 2008, 2011 The Apache Software Foundation
+//
+// Licensed 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 org.apache.tapestry5.ioc.util;
+
+import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
+
+/**
+ * A simple, streamlined implementation of {@link java.util.Stack}. The implementation is <em>not</em> threadsafe.
+ *
+ * @param <E> the type of elements stored in the map
+ * @see CollectionFactory#newStack()
+ */
+public class Stack<E>
+{
+ private static final int MINIMUM_SIZE = 3;
+
+ private static final int DEFAULT_ARRAY_SIZE = 20;
+
+ private Object[] items;
+
+ private int index = -1;
+
+ /**
+ * Normal constructor supporting an initial size of 20.
+ */
+ public Stack()
+ {
+ this(DEFAULT_ARRAY_SIZE);
+ }
+
+ /**
+ * @param initialSize the initial size of the internal array (which will be expanded as necessary). For best
+ * efficiency, set this to the maximum depth of the stack.
+ */
+ public Stack(int initialSize)
+ {
+ items = new Object[Math.max(initialSize, MINIMUM_SIZE)];
+ }
+
+ /**
+ * Returns true if the stack is empty.
+ */
+ public boolean isEmpty()
+ {
+ return index < 0;
+ }
+
+ /**
+ * Returns the number of items currently in the stack.
+ */
+ public int getDepth()
+ {
+ return index + 1;
+ }
+
+ /**
+ * Clears the stack, the same as popping off all elements.
+ */
+ public void clear()
+ {
+ for (int i = 0; i <= index; i++) items[i] = null;
+
+ index = -1;
+ }
+
+ /**
+ * Pushes a new item onto the stack.
+ */
+ public void push(E item)
+ {
+ index++;
+
+ if (index == items.length)
+ {
+ int newCapacity = (items.length * 3) / 2 + 1;
+ Object[] newItems = new Object[newCapacity];
+ System.arraycopy(items, 0, newItems, 0, items.length);
+
+ items = newItems;
+ }
+
+ items[index] = item;
+ }
+
+ /**
+ * Pops the top element off the stack and returns it.
+ *
+ * @return the top element of the stack
+ * @throws IllegalStateException if the stack is empty
+ */
+ @SuppressWarnings("unchecked")
+ public E pop()
+ {
+ checkIfEmpty();
+
+ Object result = items[index];
+
+ items[index] = null;
+
+ index--;
+
+ return (E) result;
+ }
+
+ private void checkIfEmpty()
+ {
+ if (index < 0) throw new IllegalStateException("Stack is empty.");
+ }
+
+ /**
+ * Returns the top element of the stack without affecting the stack.
+ *
+ * @return top element on the stack
+ * @throws IllegalStateException if the stack is empty
+ */
+ @SuppressWarnings("unchecked")
+ public E peek()
+ {
+ checkIfEmpty();
+
+ return (E) items[index];
+ }
+
+ /**
+ * Describes the stack, listing the element in order of depth (top element first).
+ *
+ * @return string description of the stack
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder("Stack[");
+
+ for (int i = index; i >= 0; i--)
+ {
+ if (i != index) builder.append(", ");
+
+ builder.append(String.valueOf(items[i]));
+ }
+
+ builder.append("]");
+
+ return builder.toString();
+ }
+
+ /**
+ * Returns a snapshot of the current state of the stack as an array of objects. The first object is the deepest in
+ * the stack, the last object is the most shallowest (most recently pushed onto the stack). The returned array may
+ * be manipulated (it is a copy).
+ *
+ * @return the stack as an object array
+ */
+ public Object[] getSnapshot()
+ {
+ Object[] result = new Object[index + 1];
+
+ System.arraycopy(items, 0, result, 0, index + 1);
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g b/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
deleted file mode 100644
index 3b52ba9..0000000
--- a/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright 2008, 2010, 2011 The Apache Software Foundation
-//
-// Licensed 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.
-
-lexer grammar PropertyExpressionLexer;
-
-
-options
-{
- superClass='org.apache.tapestry5.internal.antlr.BaseLexer';
-}
-
-@header
-{
-package org.apache.tapestry5.internal.antlr;
-}
-
-
-// Integer constant
-fragment INTEGER
- : {this.getClass(); /* Fix java.lang.VerifyError: Stack size too large */};
-
-// Read a property or invoke a method.
-fragment DEREF
- : {this.getClass(); /* Fix java.lang.VerifyError: Stack size too large */};
-
-// Range operator, ".." between two integers.
-fragment RANGEOP
- : {this.getClass(); /* Fix java.lang.VerifyError: Stack size too large */};
-
-// Decimal number
-fragment DECIMAL
- : {this.getClass(); /* Fix java.lang.VerifyError: Stack size too large */};
-
-fragment LETTER
- : ('a'..'z'|'A'..'Z');
-fragment DIGIT
- : '0'..'9';
-fragment SIGN
- : ('+'|'-');
-LPAREN : '(';
-RPAREN : ')';
-LBRACKET: '[';
-RBRACKET: ']';
-COMMA : ',';
-BANG : '!';
-LBRACE : '{';
-RBRACE : '}';
-COLON : ':';
-
-fragment QUOTE
- : '\'';
-
-// Clumsy but effective approach to case-insensitive identifiers.
-
-fragment A
- : ('a' | 'A');
-fragment E
- : ('e' | 'E');
-fragment F
- : ('f' | 'F');
-fragment H
- : ('h' | 'H');
-fragment I
- : ('i' | 'I');
-fragment L
- : ('l' | 'L');
-fragment N
- : ('n'|'N');
-fragment R
- : ('r' | 'R');
-fragment S
- : ('s' | 'S');
-fragment T
- : ('t' | 'T');
-fragment U
- : ('u' | 'U');
-
-// Identifiers are case insensitive
-
-NULL : N U L L;
-TRUE : T R U E;
-FALSE : F A L S E;
-THIS : T H I S;
-
-IDENTIFIER
- : JAVA_ID_START (JAVA_ID_PART)*
- ;
-
-fragment
-JAVA_ID_START
- : '\u0024'
- | '\u0041'..'\u005a'
- | '\u005f'
- | '\u0061'..'\u007a'
- | '\u00c0'..'\u00d6'
- | '\u00d8'..'\u00f6'
- | '\u00f8'..'\u00ff'
- | '\u0100'..'\u1fff'
- | '\u3040'..'\u318f'
- | '\u3300'..'\u337f'
- | '\u3400'..'\u3d2d'
- | '\u4e00'..'\u9fff'
- | '\uf900'..'\ufaff'
- ;
-
-fragment
-JAVA_ID_PART
- : JAVA_ID_START
- | '\u0030'..'\u0039'
- ;
-
-
-// The Safe Dereference operator understands not to de-reference through
-// a null.
-
-SAFEDEREF
- : '?.';
-
-WS : (' '|'\t'|'\n'|'\r')+ { skip(); };
-
-
-// Literal strings are always inside single quotes.
-STRING
- : QUOTE (options {greedy=false;} : .)* QUOTE { setText(getText().substring(1, getText().length()-1)); };
-
-
-// Special rule that uses parsing tricks to identify numbers and ranges; it's all about
-// the dot ('.').
-// Recognizes:
-// '.' as DEREF
-// '..' as RANGEOP
-// INTEGER (sign? digit+)
-// DECIMAL (sign? digits* . digits+)
-// Has to watch out for embedded rangeop (i.e. "1..10" is not "1." and ".10").
-
-NUMBER_OR_RANGEOP
- : SIGN? DIGIT+
- (
- { input.LA(2) != '.' }? => '.' DIGIT* { $type = DECIMAL; stripLeadingPlus(); }
- | { $type = INTEGER; stripLeadingPlus(); }
- )
-
- | SIGN '.' DIGIT+ { $type = DECIMAL; stripLeadingPlus(); }
-
- | '.'
- (
- DIGIT+ { $type = DECIMAL; stripLeadingPlus();}
- | '.' {$type = RANGEOP; }
- | {$type = DEREF; }
- )
- ;
-
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g b/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
deleted file mode 100644
index 14753e6..0000000
--- a/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2008, 2009, 2011 The Apache Software Foundation
-//
-// Licensed 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.
-
-parser grammar PropertyExpressionParser;
-
-
-options
-{
- superClass='org.apache.tapestry5.internal.antlr.BaseParser';
- output=AST;
- ASTLabelType=CommonTree;
- tokenVocab=PropertyExpressionLexer;
- backtrack=true;
-}
-
-tokens
-{
- // Parser token representing a method invocation
- INVOKE;
- // A List (top level, or as method parameter)
- LIST;
- //A Map (top level, or as method parameter)
- MAP;
- // Not operation (invert a boolean)
- NOT;
-}
-
-@header
-{
-package org.apache.tapestry5.internal.antlr;
-}
-
-
-start : expression^ EOF!;
-
-expression
- : keyword
- | rangeOp
- | constant
- | propertyChain
- | list
- | notOp
- | map
- ;
-
-keyword : NULL | TRUE | FALSE | THIS;
-
-constant: INTEGER| DECIMAL | STRING;
-
-propertyChain
- : term DEREF propertyChain -> ^(DEREF term propertyChain)
- | term SAFEDEREF propertyChain -> ^(SAFEDEREF term propertyChain)
- | term
- ;
-
-term : IDENTIFIER
- | methodInvocation
- ;
-
-methodInvocation
- : id=IDENTIFIER LPAREN RPAREN -> ^(INVOKE $id)
- | id=IDENTIFIER LPAREN expressionList RPAREN -> ^(INVOKE $id expressionList)
- ;
-
-expressionList
- : expression (COMMA! expression)*
- ;
-
-rangeOp
- : from=rangeopArg RANGEOP to=rangeopArg -> ^(RANGEOP $from $to)
- ;
-
-rangeopArg
- : INTEGER
- | propertyChain
- ;
-
-list : LBRACKET RBRACKET -> ^(LIST)
- | LBRACKET expressionList RBRACKET -> ^(LIST expressionList)
- ;
-
-notOp : BANG expression -> ^(NOT expression)
- ;
-
-map : LBRACE RBRACE -> ^(MAP)
- | LBRACE mapEntryList RBRACE -> ^(MAP mapEntryList)
- ;
-
-mapEntryList : mapEntry (COMMA! mapEntry)*;
-
-mapEntry : mapKey COLON! expression;
-
-mapKey : keyword | constant | propertyChain;
-
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/BaseLexer.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/BaseLexer.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/BaseLexer.java
deleted file mode 100644
index 442240d..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/BaseLexer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2008, 2009 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.internal.antlr;
-
-import org.antlr.runtime.CharStream;
-import org.antlr.runtime.Lexer;
-import org.antlr.runtime.RecognizerSharedState;
-import org.antlr.runtime.RecognitionException;
-
-public abstract class BaseLexer extends Lexer
-{
- protected BaseLexer()
- {
- }
-
- protected BaseLexer(CharStream charStream,
- RecognizerSharedState recognizerSharedState)
- {
- super(charStream, recognizerSharedState);
- }
-
- protected void stripLeadingPlus()
- {
- String text = getText();
-
- // For compatibility with Tapestry 5.0, we need to allow a sign of '+', which Long.parseLong()
- // doesn't accept. To keep things downstream simple, we eliminate the '+' here.
-
- if (text.startsWith("+"))
- {
- setText(text.substring(1));
- }
- }
-
- @Override
- public void reportError(RecognitionException e)
- {
- throw new RuntimeException(String.format("Unable to parse input at character position %d",
- e.charPositionInLine + 1),
- e);
- }
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/BaseParser.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/BaseParser.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/BaseParser.java
deleted file mode 100644
index 212b782..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/BaseParser.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2009 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.internal.antlr;
-
-import org.antlr.runtime.Parser;
-import org.antlr.runtime.TokenStream;
-import org.antlr.runtime.RecognizerSharedState;
-
-public class BaseParser extends Parser
-{
- public BaseParser(TokenStream tokenStream)
- {
- super(tokenStream);
- }
-
- public BaseParser(TokenStream tokenStream,
- RecognizerSharedState recognizerSharedState)
- {
- super(tokenStream, recognizerSharedState);
- }
-
- @Override
- public void emitErrorMessage(String message)
- {
- // This is caught and more properly reported later.
- throw new RuntimeException(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/package-info.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/package-info.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/package-info.java
deleted file mode 100644
index 55be313..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/antlr/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2012 The Apache Software Foundation
-//
-// Licensed 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.
-
-/**
- * [INTERNAL USE ONLY] support classes related to Antlr; API subject to change
- */
-package org.apache.tapestry5.internal.antlr;
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/Invariant.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/Invariant.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/Invariant.java
deleted file mode 100644
index 924b570..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/Invariant.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2008 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.internal.services;
-
-import java.lang.annotation.*;
-
-/**
- * Special annotation that is applied to literal {@link org.apache.tapestry5.PropertyConduit}s, to inform {@link
- * org.apache.tapestry5.internal.bindings.PropBinding} that the value is, in fact, invariant.
- */
-@Target({ElementType.PARAMETER, ElementType.FIELD})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface Invariant
-{
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
deleted file mode 100644
index 1fffd4f..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LiteralPropertyConduit.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2008, 2011 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.internal.services;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import org.apache.tapestry5.internal.InternalPropertyConduit;
-import org.apache.tapestry5.ioc.AnnotationProvider;
-import org.apache.tapestry5.ioc.services.TypeCoercer;
-
-/**
- * A PropertyConduit for a literal value in an expression, such as a number, or "true", "false" or "null".
- */
-public class LiteralPropertyConduit extends PropertyConduitDelegate implements InternalPropertyConduit
-{
- private final Class propertyType;
-
- private final AnnotationProvider annotationProvider;
-
- private final String description;
-
- private final Object value;
-
- public LiteralPropertyConduit(TypeCoercer typeCoercer, Class propertyType, AnnotationProvider annotationProvider,
- String description, Object value)
- {
- super(typeCoercer);
-
- this.propertyType = propertyType;
- this.annotationProvider = annotationProvider;
- this.description = description;
-
- this.value = value;
- }
-
- public Object get(Object instance)
- {
- return value;
- }
-
- public void set(Object instance, Object value)
- {
- throw new RuntimeException("Literal values are not updateable.");
- }
-
- public Class getPropertyType()
- {
- return propertyType;
- }
-
- public Type getPropertyGenericType()
- {
- return propertyType;
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
- {
- return annotationProvider.getAnnotation(annotationClass);
- }
-
- public String getPropertyName()
- {
- return null;
- }
-
- @Override
- public String toString()
- {
- return description;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyExpressionException.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyExpressionException.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyExpressionException.java
deleted file mode 100644
index 765c0bb..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyExpressionException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2008 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.internal.services;
-
-/**
- * Exception thrown when there is a problem parsing a property expression using the ANTLR property expression grammar.
- */
-public class PropertyExpressionException extends RuntimeException
-{
- private final String expression;
-
- public PropertyExpressionException(String message, String expression, Throwable cause)
- {
- super(message, cause);
-
- this.expression = expression;
- }
-
- /**
- * Returns the property expression containing the error.
- */
- public String getExpression()
- {
- return expression;
- }
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StringInterner.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StringInterner.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StringInterner.java
deleted file mode 100644
index 78ee5f4..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/StringInterner.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2009 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.internal.services;
-
-/**
- * Creates "interned" strings that are unique for the same content. This is used for common description strings,
- * particularly those used by {@link org.apache.tapestry5.Binding} instances. The internal cache of interned strings id
- * cleared whenever the {@link org.apache.tapestry5.services.ComponentClasses} {@link
- * org.apache.tapestry5.services.InvalidationEventHub} is invalidated (i.e., when component class files change).
- *
- * @since 5.1.0.0
- */
-public interface StringInterner
-{
- /**
- * Interns a string.
- *
- * @param string the string to intern
- * @return the input string, or another string instance with the same content
- */
- String intern(String string);
-
- /**
- * Formats a string (using {@link String#format(String, Object[])}) and returns the interned result.
- *
- * @param format string format
- * @param arguments used inside the format
- * @return formatted and interned string
- */
- String format(String format, Object... arguments);
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectCreator.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectCreator.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectCreator.java
deleted file mode 100644
index e7990fc..0000000
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectCreator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2006, 2008, 2011 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.ioc;
-
-/**
- * Interface used to encapsulate any strategy used defer the creation of some object until just as needed.
- */
-public interface ObjectCreator<T>
-{
- /**
- * Create and return the object. In some limited circumstances, the implementation may cache the result, returning
- * the same object for repeated calls.
- */
- T createObject();
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/IncompatibleChange.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/IncompatibleChange.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/IncompatibleChange.java
deleted file mode 100644
index ffc9490..0000000
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/IncompatibleChange.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed 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 org.apache.tapestry5.ioc.annotations;
-
-import java.lang.annotation.*;
-
-@Target({ElementType.METHOD, ElementType.FIELD})
-@Retention(RetentionPolicy.CLASS)
-@Documented
-public @interface IncompatibleChange
-{
- /**
- * Identifies the release in which the signature of the method was modified.
- *
- * @return a release number, e.g., "5.4"
- */
- String release();
-
- /**
- * Short string describing what changed.
- */
- String details();
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java
deleted file mode 100644
index 75e93e4..0000000
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PlasticProxyFactory.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2011, 2012 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.ioc.services;
-
-import org.apache.tapestry5.ioc.Location;
-import org.apache.tapestry5.ioc.ObjectCreator;
-import org.apache.tapestry5.ioc.annotations.IncompatibleChange;
-import org.apache.tapestry5.plastic.ClassInstantiator;
-import org.apache.tapestry5.plastic.PlasticClassListenerHub;
-import org.apache.tapestry5.plastic.PlasticClassTransformation;
-import org.apache.tapestry5.plastic.PlasticClassTransformer;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
-/**
- * A service used to create proxies of varying types. As a secondary concern, manages to identify the
- * location of methods and constructors, which is important for exception reporting.
- *
- * @since 5.3
- */
-public interface PlasticProxyFactory extends PlasticClassListenerHub
-{
- /**
- * Returns the class loader used when creating new classes, this is a child class loader
- * of another class loader (usually, the thread's context class loader).
- */
- ClassLoader getClassLoader();
-
- /**
- * Creates a proxy object that implements the indicated interface, then invokes the callback to further
- * configure the proxy.
- *
- * @param interfaceType
- * interface implemented by proxy
- * @param callback
- * configures the proxy
- * @return instantiator that can be used to create an instance of the proxy class
- */
- <T> ClassInstantiator<T> createProxy(Class<T> interfaceType, PlasticClassTransformer callback);
-
- /**
- * Creates a proxy object that implements the indicated interface and indicated service implementation type,
- * then invokes the callback to further configure the proxy.
- *
- * @param interfaceType
- * interface implemented by proxy
- * @param implementationType
- * a class that implements the interfaceType. It can be null.
- * @param callback
- * configures the proxy
- * @return instantiator that can be used to create an instance of the proxy class
- */
- @IncompatibleChange(release = "5.4", details = "TAP5-2029")
- <T> ClassInstantiator<T> createProxy(Class<T> interfaceType, Class<? extends T> implementationType, PlasticClassTransformer callback);
-
- /**
- * Creates the underlying {@link PlasticClassTransformation} for an interface proxy. This should only be
- * used in the cases where encapsulating the PlasticClass construction into a {@linkplain PlasticClassTransformer
- * callback} is not feasible (which is the case for some of the older APIs inside Tapestry IoC).
- *
- * @param interfaceType
- * class proxy will extend from
- * @return transformation from which an instantiator may be created
- */
- <T> PlasticClassTransformation<T> createProxyTransformation(Class<T> interfaceType);
-
- /**
- * Creates the underlying {@link PlasticClassTransformation} for an interface proxy with a given
- * implementation class. This should only be
- * used in the cases where encapsulating the PlasticClass construction into a {@linkplain PlasticClassTransformer
- * callback} is not feasible (which is the case for some of the older APIs inside Tapestry IoC).
- *
- * @param interfaceType
- * class proxy will extend from
- * @param implementationType
- * a class that implements the interfaceType. It can be null.
- * @return transformation from which an instantiator may be created
- */
- @IncompatibleChange(release = "5.4", details = "TAP5-2029")
- <T> PlasticClassTransformation<T> createProxyTransformation(Class<T> interfaceType, Class<? extends T> implementationType);
-
- /**
- * Creates a proxy instance that delegates all methods through a corresponding
- * ObjectCreator. Each method invocation on the proxy will route through {@link ObjectCreator#createObject()} (the
- * creator implementation may decide to
- * cache the return value as appropriate).
- *
- * @param <T>
- * type of proxy
- * @param interfaceType
- * interface class for proxy
- * @param creator
- * object responsible for creating the real object
- * @param description
- * the <code>toString()</code> of the proxy
- * @return proxy instance
- */
- <T> T createProxy(Class<T> interfaceType, ObjectCreator<T> creator, String description);
-
- /**
- * Creates a proxy instance that delegates all methods through a corresponding
- * ObjectCreator. Each method invocation on the proxy will route through {@link ObjectCreator#createObject()} (the
- * creator implementation may decide to
- * cache the return value as appropriate).
- *
- * @param <T>
- * type of proxy
- * @param interfaceType
- * interface class for proxy
- * @param implementationType
- * class that implements the interface type. It may be null
- * @param creator
- * object responsible for creating the real object
- * @param description
- * the <code>toString()</code> of the proxy
- * @return proxy instance
- */
- @IncompatibleChange(release = "5.4", details = "Added for TAP5-2029")
- <T> T createProxy(Class<T> interfaceType, Class<? extends T> implementationType, ObjectCreator<T> creator, String description);
-
- /**
- * Converts a method to a {@link Location}, which includes information about the source file name and line number.
- *
- * @param method
- * to look up
- * @return the location (identifying the method and possibly, the line number within the method)
- */
- Location getMethodLocation(Method method);
-
- /**
- * Return a string representation for the constructor (including class and parameters) and (if available) file name
- * and line number.
- *
- * @return the location (identifying the constructor and possibly, the line number within the method)
- */
- Location getConstructorLocation(Constructor constructor);
-
- /**
- * Clears any cached information stored by the proxy factory; this is useful in Tapestry development mode
- * when a class loader may have been discarded (because the proxy factory may indirectly keep references
- * to classes loaded by the old class loader).
- *
- * @since 5.3.3
- */
- void clearCache();
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/Stack.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/Stack.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/Stack.java
deleted file mode 100644
index cfa13a0..0000000
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/Stack.java
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2007, 2008, 2011 The Apache Software Foundation
-//
-// Licensed 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 org.apache.tapestry5.ioc.util;
-
-import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-
-/**
- * A simple, streamlined implementation of {@link java.util.Stack}. The implementation is <em>not</em> threadsafe.
- *
- * @param <E> the type of elements stored in the map
- * @see CollectionFactory#newStack()
- */
-public class Stack<E>
-{
- private static final int MINIMUM_SIZE = 3;
-
- private static final int DEFAULT_ARRAY_SIZE = 20;
-
- private Object[] items;
-
- private int index = -1;
-
- /**
- * Normal constructor supporting an initial size of 20.
- */
- public Stack()
- {
- this(DEFAULT_ARRAY_SIZE);
- }
-
- /**
- * @param initialSize the initial size of the internal array (which will be expanded as necessary). For best
- * efficiency, set this to the maximum depth of the stack.
- */
- public Stack(int initialSize)
- {
- items = new Object[Math.max(initialSize, MINIMUM_SIZE)];
- }
-
- /**
- * Returns true if the stack is empty.
- */
- public boolean isEmpty()
- {
- return index < 0;
- }
-
- /**
- * Returns the number of items currently in the stack.
- */
- public int getDepth()
- {
- return index + 1;
- }
-
- /**
- * Clears the stack, the same as popping off all elements.
- */
- public void clear()
- {
- for (int i = 0; i <= index; i++) items[i] = null;
-
- index = -1;
- }
-
- /**
- * Pushes a new item onto the stack.
- */
- public void push(E item)
- {
- index++;
-
- if (index == items.length)
- {
- int newCapacity = (items.length * 3) / 2 + 1;
- Object[] newItems = new Object[newCapacity];
- System.arraycopy(items, 0, newItems, 0, items.length);
-
- items = newItems;
- }
-
- items[index] = item;
- }
-
- /**
- * Pops the top element off the stack and returns it.
- *
- * @return the top element of the stack
- * @throws IllegalStateException if the stack is empty
- */
- @SuppressWarnings("unchecked")
- public E pop()
- {
- checkIfEmpty();
-
- Object result = items[index];
-
- items[index] = null;
-
- index--;
-
- return (E) result;
- }
-
- private void checkIfEmpty()
- {
- if (index < 0) throw new IllegalStateException("Stack is empty.");
- }
-
- /**
- * Returns the top element of the stack without affecting the stack.
- *
- * @return top element on the stack
- * @throws IllegalStateException if the stack is empty
- */
- @SuppressWarnings("unchecked")
- public E peek()
- {
- checkIfEmpty();
-
- return (E) items[index];
- }
-
- /**
- * Describes the stack, listing the element in order of depth (top element first).
- *
- * @return string description of the stack
- */
- @Override
- public String toString()
- {
- StringBuilder builder = new StringBuilder("Stack[");
-
- for (int i = index; i >= 0; i--)
- {
- if (i != index) builder.append(", ");
-
- builder.append(String.valueOf(items[i]));
- }
-
- builder.append("]");
-
- return builder.toString();
- }
-
- /**
- * Returns a snapshot of the current state of the stack as an array of objects. The first object is the deepest in
- * the stack, the last object is the most shallowest (most recently pushed onto the stack). The returned array may
- * be manipulated (it is a copy).
- *
- * @return the stack as an object array
- */
- public Object[] getSnapshot()
- {
- Object[] result = new Object[index + 1];
-
- System.arraycopy(items, 0, result, 0, index + 1);
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1f36bb20/tapestry5-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/IncompatibleChange.java
----------------------------------------------------------------------
diff --git a/tapestry5-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/IncompatibleChange.java b/tapestry5-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/IncompatibleChange.java
new file mode 100644
index 0000000..ffc9490
--- /dev/null
+++ b/tapestry5-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/IncompatibleChange.java
@@ -0,0 +1,33 @@
+// Licensed 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 org.apache.tapestry5.ioc.annotations;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.CLASS)
+@Documented
+public @interface IncompatibleChange
+{
+ /**
+ * Identifies the release in which the signature of the method was modified.
+ *
+ * @return a release number, e.g., "5.4"
+ */
+ String release();
+
+ /**
+ * Short string describing what changed.
+ */
+ String details();
+}