You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/12/20 00:56:10 UTC
[13/49] groovy git commit: Move source files to proper packages
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/SpreadListEvaluatingException.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/SpreadListEvaluatingException.java b/src/main/groovy/lang/SpreadListEvaluatingException.java
deleted file mode 100644
index b6de965..0000000
--- a/src/main/groovy/lang/SpreadListEvaluatingException.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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 groovy.lang;
-
-public class SpreadListEvaluatingException extends GroovyRuntimeException {
- public SpreadListEvaluatingException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/SpreadMap.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/SpreadMap.java b/src/main/groovy/lang/SpreadMap.java
deleted file mode 100644
index 7ba9e4f..0000000
--- a/src/main/groovy/lang/SpreadMap.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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 groovy.lang;
-
-import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Helper to turn a list with an even number of elements into a Map.
- *
- * @author Pilho Kim
- * @author Tim Tiemens
- */
-public class SpreadMap extends HashMap {
- private int hashCode;
-
- public SpreadMap(Object[] values) {
- int i = 0;
- while (i < values.length) {
- super.put(values[i++], values[i++]);
- }
- }
-
- public SpreadMap(Map map) {
- super(map);
- }
-
- /**
- * @since 1.8.0
- * @param list the list to make spreadable
- */
- public SpreadMap(List list) {
- this(list.toArray());
- }
-
- public Object put(Object key, Object value) {
- throw new RuntimeException("SpreadMap: " + this + " is an immutable map, and so ("
- + key + ": " + value + ") cannot be added.");
- }
-
- public Object remove(Object key) {
- throw new RuntimeException("SpreadMap: " + this + " is an immutable map, and so the key ("
- + key + ") cannot be deleted.");
- }
-
- public void putAll(Map t) {
- throw new RuntimeException("SpreadMap: " + this + " is an immutable map, and so the map ("
- + t + ") cannot be put in this spreadMap.");
- }
-
- public boolean equals(Object that) {
- if (that instanceof SpreadMap) {
- return equals((SpreadMap) that);
- }
- return false;
- }
-
- public boolean equals(SpreadMap that) {
- if (that == null) return false;
-
- if (size() == that.size()) {
- for (Object key : keySet()) {
- if (!DefaultTypeTransformation.compareEqual(get(key), that.get(key))) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- public int hashCode() {
- if (hashCode == 0) {
- for (Object key : keySet()) {
- int hash = (key != null) ? key.hashCode() : 0xbabe;
- hashCode ^= hash;
- }
- }
- return hashCode;
- }
-
- /**
- * @return the string expression of <code>this</code>
- */
- public String toString() {
- if (isEmpty()) {
- return "*:[:]";
- }
- StringBuilder sb = new StringBuilder("*:[");
- Iterator iter = keySet().iterator();
- while (iter.hasNext()) {
- Object key = iter.next();
- sb.append(key).append(":").append(get(key));
- if (iter.hasNext())
- sb.append(", ");
- }
- sb.append("]");
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/SpreadMapEvaluatingException.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/SpreadMapEvaluatingException.java b/src/main/groovy/lang/SpreadMapEvaluatingException.java
deleted file mode 100644
index 408a223..0000000
--- a/src/main/groovy/lang/SpreadMapEvaluatingException.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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 groovy.lang;
-
-public class SpreadMapEvaluatingException extends GroovyRuntimeException {
- public SpreadMapEvaluatingException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/StringWriterIOException.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/StringWriterIOException.java b/src/main/groovy/lang/StringWriterIOException.java
deleted file mode 100644
index 0372399..0000000
--- a/src/main/groovy/lang/StringWriterIOException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 groovy.lang;
-
-import java.io.IOException;
-
-/**
- * An IO exception occurred trying to append to a StringWriter which should never happen.
- *
- * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
- */
-public class StringWriterIOException extends RuntimeException {
-
- public StringWriterIOException(IOException e) {
- super(e);
- }
-
- public IOException getIOException() {
- return (IOException) getCause();
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/TracingInterceptor.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/TracingInterceptor.java b/src/main/groovy/lang/TracingInterceptor.java
deleted file mode 100644
index f67de11..0000000
--- a/src/main/groovy/lang/TracingInterceptor.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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 groovy.lang;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-
-/*
- * This {@link Interceptor} traces method calls on the proxied object to a log.
- * By default, the log is simply <pre>System.out</pre>; however, that can be
- * changed with the <pre>setWriter(Writer)</pre> method.
- * <p>
- * A message will be written to output before a method is invoked and after a method
- * is invoked. If methods are nested, and invoke one another, then indentation
- * of two spaces is written.
- * <p>
- * Here is an example usage on the ArrayList object: <br>
- * <pre class="groovyTestCase">
- * def proxy = ProxyMetaClass.getInstance(ArrayList.class)
- * proxy.interceptor = new TracingInterceptor()
- * proxy.use {
- * def list = [1, 2, 3]
- * assert 3 == list.size()
- * assert list.contains(1)
- * }
- * </pre>
- * Running this code produces this output:
- * <pre>
- * before java.util.ArrayList.size()
- * after java.util.ArrayList.size()
- * before java.util.ArrayList.contains(java.lang.Integer)
- * after java.util.ArrayList.contains(java.lang.Integer)
- * </pre>
- */
-public class TracingInterceptor implements Interceptor {
-
- protected Writer writer = new PrintWriter(System.out);
- private int indent = 0;
-
- /**
- * Returns the writer associated with this interceptor.
- */
- public Writer getWriter() {
- return writer;
- }
-
- /**
- * Changes the writer associated with this interceptor.
- */
- public void setWriter(Writer writer) {
- this.writer = writer;
- }
-
- public Object beforeInvoke(Object object, String methodName, Object[] arguments) {
- write(object, methodName, arguments, "before");
- indent++ ;
- return null;
- }
-
- public Object afterInvoke(Object object, String methodName, Object[] arguments, Object result) {
- indent--;
- write(object, methodName, arguments, "after ");
- return result;
- }
-
- public boolean doInvoke() {
- return true;
- }
- private String indent(){
- StringBuilder result = new StringBuilder();
- for (int i=0; i<indent;i++){
- result.append(" ");
- }
- return result.toString();
- }
-
- protected void write(Object object, String methodName, Object[] arguments, final String origin) {
- try {
- writer.write(indent());
- writer.write(origin);
- writer.write(" ");
- Class theClass = object instanceof Class ? (Class) object: object.getClass();
- writeInfo(theClass, methodName, arguments);
- writer.write("\n");
- writer.flush();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- protected void writeInfo(final Class aClass, String methodName, Object[] arguments) throws IOException {
- writer.write(aClass.getName());
- writer.write(".");
- writer.write(methodName);
- writer.write("(");
- for (int i = 0; i < arguments.length; i++) {
- if (i > 0) writer.write(", ");
- Object argument = arguments[i];
- writer.write(argument.getClass().getName());
- }
- writer.write(")");
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/TrampolineClosure.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/TrampolineClosure.java b/src/main/groovy/lang/TrampolineClosure.java
deleted file mode 100644
index ed68f00..0000000
--- a/src/main/groovy/lang/TrampolineClosure.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * A TrampolineClosure wraps a closure that needs to be executed on a functional trampoline.
- * Upon calling, a TrampolineClosure will call the original closure waiting for its result.
- * If the outcome of the call is another instance of a TrampolineClosure, created perhaps as a result to a call to the TrampolineClosure.trampoline()
- * method, the TrampolineClosure will again be invoked. This repetitive invocation of returned TrampolineClosure instances will continue
- * until a value other than TrampolineClosure is returned.
- * That value will become the final result of the trampoline.
- *
- * @author Vaclav Pech
- */
-final class TrampolineClosure<V> extends Closure<V> {
-
- private final Closure<V> original;
-
- TrampolineClosure(final Closure<V> original) {
- super(original.getOwner(), original.getDelegate());
- this.original = original;
- }
-
- /**
- * Delegates to the wrapped closure
- */
- @Override
- public int getMaximumNumberOfParameters() {
- return original.maximumNumberOfParameters;
- }
-
- /**
- * Delegates to the wrapped closure
- */
- @Override
- public Class[] getParameterTypes() {
- return original.parameterTypes;
- }
-
- /**
- * Starts the trampoline loop and calls the wrapped closure as the first step.
- * @return The final result of the trampoline
- */
- @Override
- public V call() {
- return loop(original.call());
- }
-
- /**
- * Starts the trampoline loop and calls the wrapped closure as the first step.
- * @return The final result of the trampoline
- */
- @Override
- public V call(final Object arguments) {
- return loop(original.call(arguments));
- }
-
- /**
- * Starts the trampoline loop and calls the wrapped closure as the first step.
- * @return The final result of the trampoline
- */
- @Override
- public V call(final Object... args) {
- return loop(original.call(args));
- }
-
- private V loop(final Object lastResult) {
- Object result = lastResult;
-
- for (;;) {
- if (result instanceof TrampolineClosure) {
- result = ((TrampolineClosure)result).original.call();
- } else return (V) result;
- }
- }
-
- /**
- * Builds a trampolined variant of the current closure.
- * @param args Parameters to curry to the underlying closure.
- * @return An instance of TrampolineClosure wrapping the original closure after currying.
- */
- @Override
- public Closure<V> trampoline(final Object... args) {
- return new TrampolineClosure<V>(original.curry(args));
- }
-
- /**
- * Returns itself, since it is a good enough trampolined variant of the current closure.
- * @return An instance of TrampolineClosure wrapping the original closure.
- */
- @Override
- public Closure<V> trampoline() {
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple.java b/src/main/groovy/lang/Tuple.java
deleted file mode 100644
index 036d13e..0000000
--- a/src/main/groovy/lang/Tuple.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 groovy.lang;
-
-import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation;
-
-import java.io.Serializable;
-import java.util.AbstractList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Represents a list of Objects.
- *
- * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
- */
-public class Tuple<E> extends AbstractList<E> implements Serializable {
- private static final long serialVersionUID = -6707770506387821031L;
- private final E[] contents;
-
- public Tuple(E... contents) {
- if (contents == null) throw new NullPointerException();
- this.contents = contents;
- }
-
- @Override
- public E get(int index) {
- return contents[index];
- }
-
- @Override
- public int size() {
- return contents.length;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<E> subList(int fromIndex, int toIndex) {
- int size = toIndex - fromIndex;
- E[] newContent = (E[]) new Object[size];
- System.arraycopy(contents, fromIndex, newContent, 0, size);
- return new Tuple<>(newContent);
- }
-
- public Tuple<E> subTuple(int fromIndex, int toIndex) {
- return (Tuple<E>) subList(fromIndex, toIndex);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || !(o instanceof Tuple)) return false;
-
- Tuple that = (Tuple) o;
- int size = size();
- if (size != that.size()) return false;
- for (int i = 0; i < size; i++) {
- if (!DefaultTypeTransformation.compareEqual(get(i), that.get(i))) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(contents);
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple1.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple1.java b/src/main/groovy/lang/Tuple1.java
deleted file mode 100644
index 9b8d6bd..0000000
--- a/src/main/groovy/lang/Tuple1.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 1 typed Object.
- *
- * @since 2.5.0
- */
-public class Tuple1<T1> extends Tuple {
- private static final long serialVersionUID = -4647790147461409603L;
- private final T1 first;
-
- public Tuple1(T1 first) {
- super(first);
-
- this.first = first;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 1;
- }
-
- public T1 getFirst() {
- return first;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple2.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple2.java b/src/main/groovy/lang/Tuple2.java
deleted file mode 100644
index b096aee..0000000
--- a/src/main/groovy/lang/Tuple2.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 2 typed Objects.
- */
-public class Tuple2<T1, T2> extends Tuple {
- private static final long serialVersionUID = 9006144674906325597L;
- private final T1 first;
- private final T2 second;
-
- public Tuple2(T1 first, T2 second) {
- super(first, second);
-
- this.first = first;
- this.second = second;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- case 1:
- return second;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 2;
- }
-
- public T1 getFirst() {
- return first;
- }
-
- public T2 getSecond() {
- return second;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple3.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple3.java b/src/main/groovy/lang/Tuple3.java
deleted file mode 100644
index b5fe7d9..0000000
--- a/src/main/groovy/lang/Tuple3.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 3 typed Objects.
- *
- * @since 2.5.0
- */
-public class Tuple3<T1, T2, T3> extends Tuple {
- private static final long serialVersionUID = 8469774237154310687L;
- private final T1 first;
- private final T2 second;
- private final T3 third;
-
- public Tuple3(T1 first, T2 second, T3 third) {
- super(first, second, third);
-
- this.first = first;
- this.second = second;
- this.third = third;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- case 1:
- return second;
- case 2:
- return third;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 3;
- }
-
- public T1 getFirst() {
- return first;
- }
-
- public T2 getSecond() {
- return second;
- }
-
- public T3 getThird() {
- return third;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple4.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple4.java b/src/main/groovy/lang/Tuple4.java
deleted file mode 100644
index 04f414e..0000000
--- a/src/main/groovy/lang/Tuple4.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 4 typed Objects.
- *
- * @since 2.5.0
- */
-public class Tuple4<T1, T2, T3, T4> extends Tuple {
- private static final long serialVersionUID = -7788878731471377207L;
- private final T1 first;
- private final T2 second;
- private final T3 third;
- private final T4 fourth;
-
- public Tuple4(T1 first, T2 second, T3 third, T4 fourth) {
- super(first, second, third, fourth);
-
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- case 1:
- return second;
- case 2:
- return third;
- case 3:
- return fourth;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 4;
- }
-
- public T1 getFirst() {
- return first;
- }
-
- public T2 getSecond() {
- return second;
- }
-
- public T3 getThird() {
- return third;
- }
-
- public T4 getFourth() {
- return fourth;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple5.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple5.java b/src/main/groovy/lang/Tuple5.java
deleted file mode 100644
index ee9c802..0000000
--- a/src/main/groovy/lang/Tuple5.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 5 typed Objects.
- *
- * @since 2.5.0
- */
-public class Tuple5<T1, T2, T3, T4, T5> extends Tuple {
- private static final long serialVersionUID = 6722094358774027115L;
- private final T1 first;
- private final T2 second;
- private final T3 third;
- private final T4 fourth;
- private final T5 fifth;
-
- public Tuple5(T1 first, T2 second, T3 third, T4 fourth, T5 fifth) {
- super(first, second, third, fourth, fifth);
-
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- case 1:
- return second;
- case 2:
- return third;
- case 3:
- return fourth;
- case 4:
- return fifth;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 5;
- }
-
- public T1 getFirst() {
- return first;
- }
-
- public T2 getSecond() {
- return second;
- }
-
- public T3 getThird() {
- return third;
- }
-
- public T4 getFourth() {
- return fourth;
- }
-
- public T5 getFifth() {
- return fifth;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple6.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple6.java b/src/main/groovy/lang/Tuple6.java
deleted file mode 100644
index 76d12ca..0000000
--- a/src/main/groovy/lang/Tuple6.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 6 typed Objects.
- *
- * @since 2.5.0
- */
-public class Tuple6<T1, T2, T3, T4, T5, T6> extends Tuple {
- private static final long serialVersionUID = -7848588473093102288L;
- private final T1 first;
- private final T2 second;
- private final T3 third;
- private final T4 fourth;
- private final T5 fifth;
- private final T6 sixth;
-
- public Tuple6(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth) {
- super(first, second, third, fourth, fifth, sixth);
-
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- case 1:
- return second;
- case 2:
- return third;
- case 3:
- return fourth;
- case 4:
- return fifth;
- case 5:
- return sixth;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 6;
- }
-
- public T1 getFirst() {
- return first;
- }
-
- public T2 getSecond() {
- return second;
- }
-
- public T3 getThird() {
- return third;
- }
-
- public T4 getFourth() {
- return fourth;
- }
-
- public T5 getFifth() {
- return fifth;
- }
-
- public T6 getSixth() {
- return sixth;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple7.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple7.java b/src/main/groovy/lang/Tuple7.java
deleted file mode 100644
index 05046e7..0000000
--- a/src/main/groovy/lang/Tuple7.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 7 typed Objects.
- *
- * @since 2.5.0
- */
-public class Tuple7<T1, T2, T3, T4, T5, T6, T7> extends Tuple {
- private static final long serialVersionUID = 4226144828786865766L;
- private final T1 first;
- private final T2 second;
- private final T3 third;
- private final T4 fourth;
- private final T5 fifth;
- private final T6 sixth;
- private final T7 seventh;
-
- public Tuple7(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh) {
- super(first, second, third, fourth, fifth, sixth, seventh);
-
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- case 1:
- return second;
- case 2:
- return third;
- case 3:
- return fourth;
- case 4:
- return fifth;
- case 5:
- return sixth;
- case 6:
- return seventh;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 7;
- }
-
- public T1 getFirst() {
- return first;
- }
-
- public T2 getSecond() {
- return second;
- }
-
- public T3 getThird() {
- return third;
- }
-
- public T4 getFourth() {
- return fourth;
- }
-
- public T5 getFifth() {
- return fifth;
- }
-
- public T6 getSixth() {
- return sixth;
- }
-
- public T7 getSeventh() {
- return seventh;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple8.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple8.java b/src/main/groovy/lang/Tuple8.java
deleted file mode 100644
index 1f38ca9..0000000
--- a/src/main/groovy/lang/Tuple8.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 8 typed Objects.
- *
- * @since 2.5.0
- */
-public class Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> extends Tuple {
- private static final long serialVersionUID = -8895822084644138566L;
- private final T1 first;
- private final T2 second;
- private final T3 third;
- private final T4 fourth;
- private final T5 fifth;
- private final T6 sixth;
- private final T7 seventh;
- private final T8 eighth;
-
- public Tuple8(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh, T8 eighth) {
- super(first, second, third, fourth, fifth, sixth, seventh, eighth);
-
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- case 1:
- return second;
- case 2:
- return third;
- case 3:
- return fourth;
- case 4:
- return fifth;
- case 5:
- return sixth;
- case 6:
- return seventh;
- case 7:
- return eighth;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 8;
- }
-
- public T1 getFirst() {
- return first;
- }
-
- public T2 getSecond() {
- return second;
- }
-
- public T3 getThird() {
- return third;
- }
-
- public T4 getFourth() {
- return fourth;
- }
-
- public T5 getFifth() {
- return fifth;
- }
-
- public T6 getSixth() {
- return sixth;
- }
-
- public T7 getSeventh() {
- return seventh;
- }
-
- public T8 getEighth() {
- return eighth;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Tuple9.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Tuple9.java b/src/main/groovy/lang/Tuple9.java
deleted file mode 100644
index 3189c10..0000000
--- a/src/main/groovy/lang/Tuple9.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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 groovy.lang;
-
-/**
- * Represents a list of 9 typed Objects.
- *
- * @since 2.5.0
- */
-public class Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends Tuple {
- private static final long serialVersionUID = -5181196675351911769L;
- private final T1 first;
- private final T2 second;
- private final T3 third;
- private final T4 fourth;
- private final T5 fifth;
- private final T6 sixth;
- private final T7 seventh;
- private final T8 eighth;
- private final T9 ninth;
-
- public Tuple9(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh, T8 eighth, T9 ninth) {
- super(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth);
-
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- }
-
- @Override
- public Object get(int index) {
- switch (index) {
- case 0:
- return first;
- case 1:
- return second;
- case 2:
- return third;
- case 3:
- return fourth;
- case 4:
- return fifth;
- case 5:
- return sixth;
- case 6:
- return seventh;
- case 7:
- return eighth;
- case 8:
- return ninth;
- default:
- throw new IndexOutOfBoundsException("index: " + index);
- }
- }
-
- @Override
- public int size() {
- return 9;
- }
-
- public T1 getFirst() {
- return first;
- }
-
- public T2 getSecond() {
- return second;
- }
-
- public T3 getThird() {
- return third;
- }
-
- public T4 getFourth() {
- return fourth;
- }
-
- public T5 getFifth() {
- return fifth;
- }
-
- public T6 getSixth() {
- return sixth;
- }
-
- public T7 getSeventh() {
- return seventh;
- }
-
- public T8 getEighth() {
- return eighth;
- }
-
- public T9 getNinth() {
- return ninth;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/Writable.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Writable.java b/src/main/groovy/lang/Writable.java
deleted file mode 100644
index ec135cd..0000000
--- a/src/main/groovy/lang/Writable.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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 groovy.lang;
-
-import java.io.IOException;
-import java.io.Writer;
-
-
-/**
- * Represents an object which is capable of writing itself to a text stream
- * in a more efficient format than just creating a toString() representation
- * of itself. This mechanism is particularly useful for templates and such like.
- * <p>
- * It is worth noting that writable implementations often override their
- * toString() implementation as well to allow rendering the same result
- * directly to a String; however this is not required.
- *
- * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
- */
-public interface Writable {
-
- /**
- * Writes this object to the given writer.
- * <p>
- * This is used to defer content creation until the point when it is
- * streamed to the output destination. Oftentimes, content will be defined
- * but not necessarily created (as is may be the case with a Closure
- * definition.) In that case, the output is then 'deferred' to the point
- * when it is serialized to the writer. This class may be used whenever an
- * object should be responsible for creating its own textual representation,
- * but creating the entire output as a single String would be inefficient
- * (such as outputting a multi-gigabyte XML document.)
- *
- * @param out the Writer to which this Writable should output its data.
- * @return the Writer that was passed
- * @throws IOException if an error occurred while outputting data to the writer
- */
- Writer writeTo(Writer out) throws IOException;
-
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/groovydoc/Groovydoc.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/groovydoc/Groovydoc.java b/src/main/groovy/lang/groovydoc/Groovydoc.java
deleted file mode 100644
index d7d4204..0000000
--- a/src/main/groovy/lang/groovydoc/Groovydoc.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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 groovy.lang.groovydoc;
-
-import java.lang.reflect.AnnotatedElement;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Represents groovydoc
- */
-public class Groovydoc {
- private final String content;
- private List<GroovydocTag> tagList;
- private final GroovydocHolder holder;
-
- public Groovydoc(String content, GroovydocHolder groovydocHolder) {
- this.content = content;
- this.holder = groovydocHolder;
- }
-
- public Groovydoc(final String content, final AnnotatedElement annotatedElement) {
- this.content = content;
- this.holder = new GroovydocHolder<AnnotatedElement>() {
- @Override
- public Groovydoc getGroovydoc() {
- return Groovydoc.this;
- }
-
- @Override
- public AnnotatedElement getInstance() {
- return annotatedElement;
- }
- };
- }
-
- /**
- * Get the content of groovydoc
- * @return the text content
- */
- public String getContent() {
- return content;
- }
-
- /**
- * TODO Get list of groovydoc tags
- * @return a list of tags
- */
- public List<GroovydocTag> getTagList() {
- throw new UnsupportedOperationException("[TODO]parsing tags will be a new features of the next releases");
-// return tagList;
- }
-
- /**
- * Get the holder of the groovydoc
- * @return the groovydoc holder
- */
- public GroovydocHolder getHolder() {
- return holder;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Groovydoc groovydoc = (Groovydoc) o;
- return Objects.equals(content, groovydoc.content) &&
- Objects.equals(holder, groovydoc.holder);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(content, holder);
- }
-
- @Override
- public String toString() {
- return this.content;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/groovydoc/GroovydocHolder.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/groovydoc/GroovydocHolder.java b/src/main/groovy/lang/groovydoc/GroovydocHolder.java
deleted file mode 100644
index eb41df4..0000000
--- a/src/main/groovy/lang/groovydoc/GroovydocHolder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 groovy.lang.groovydoc;
-
-/**
- * Represents Groovydoc Holder
- */
-public interface GroovydocHolder<T> {
- String DOC_COMMENT = "_DOC_COMMENT"; // keys for meta data
- /**
- * Get the groovydoc
- * @return the groovydoc
- */
- Groovydoc getGroovydoc();
-
- /**
- * Get GroovydocHolder instance
- * @return GroovydocHolder instance
- */
- T getInstance();
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/groovydoc/GroovydocTag.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/groovydoc/GroovydocTag.java b/src/main/groovy/lang/groovydoc/GroovydocTag.java
deleted file mode 100644
index 14e5aaa..0000000
--- a/src/main/groovy/lang/groovydoc/GroovydocTag.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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 groovy.lang.groovydoc;
-
-import java.util.Objects;
-
-/**
- * TODO parse groovydoc to get tag content
- */
-public class GroovydocTag {
- private String name;
- private String content;
- private Groovydoc groovydoc;
-
- public GroovydocTag(String name, String content, Groovydoc groovydoc) {
- this.name = name;
- this.content = content;
- this.groovydoc = groovydoc;
- }
-
- public String getName() {
- return name;
- }
-
- public String getContent() {
- return content;
- }
-
- public Groovydoc getGroovydoc() {
- return groovydoc;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- GroovydocTag that = (GroovydocTag) o;
- return Objects.equals(name, that.name) &&
- Objects.equals(content, that.content) &&
- Objects.equals(groovydoc, that.groovydoc);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(name, content, groovydoc);
- }
-
- @Override
- public String toString() {
- return content;
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/lang/package.html
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/package.html b/src/main/groovy/lang/package.html
deleted file mode 100644
index 1ea84fc..0000000
--- a/src/main/groovy/lang/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-
- 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.
-
--->
-<html>
- <head>
- <title>package groovy.lang.*</title>
- </head>
- <body>
- <p>Core Groovy language classes for implementing data structures, closures, metadata and so forth.</p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/groovy/blob/10110145/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy b/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy
new file mode 100644
index 0000000..24dcdd6
--- /dev/null
+++ b/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy
@@ -0,0 +1,145 @@
+/*
+ * 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 org.codehaus.groovy.ast.builder
+
+import org.codehaus.groovy.ast.ASTNode
+import org.codehaus.groovy.ast.stmt.BlockStatement
+import org.codehaus.groovy.control.CompilePhase
+
+/**
+ * The AstBuilder provides several ways to build an abstract syntax tree (AST) of Groovy code.
+ *
+ * You can convert a String into AST using the buildFromString method.
+ * You can convert code into AST using the buildFromCode method.
+ * You can use the AST DSL with the buildFromSpec method.
+ *
+ * For more information, see the resources on the Groovy wiki pages.
+ *
+ * @author Hamlet D'Arcy
+ */
+
+public class AstBuilder {
+
+ /**
+ * Builds AST based on the code within the {@link Closure} parameter.
+ *
+ * This method <strong>must</strong> be invoked at compile time and never at runtime, because
+ * an ASTTransformation must be run to support it. If you receive an IllegalStateException then
+ * you most likely need to add stronger typing. For instance, this will not work:
+ * <code>
+ * def builder = new AstBuilder()
+ * builder.buildFromCode {
+ * // some code
+ * }
+ * </code>
+ * While this code will:
+ * <code>
+ * new AstBuilder().buildFromCode {
+ * // some code
+ * }
+ * </code>
+ *
+ * The compiler rewrites buildFromCode invocations into {@link AstBuilder#buildFromString(CompilePhase, boolean, String)}
+ * invocations. An exception raised during AST generation will show a stack trace from {@link AstBuilder#buildFromString(CompilePhase, boolean, String)}
+ * and not from {@link AstBuilder#buildFromCode(CompilePhase, boolean, Closure)} .
+ *
+ * The compiler saves the source code of the closure as a String within the Java class file. The String source
+ * of the closure will be visible and un-obfuscated within the class file. If your Closure parameter contains
+ * sensitive data such as a hard-coded password then that data is free to be seen by anyone with the class file.
+ * Do not store sensitive data within the closure parameter.
+ *
+ * @param phase
+ * the {@link CompilePhase} the AST will be targeted towards. Default is {@link CompilePhase#CLASS_GENERATION}
+ * @param statementsOnly
+ * when true, only the script statements are returned. WHen false, you will
+ * receive back a Script class node also. Default is true.
+ * @param block
+ * the code that will be converted
+ * @returns a List of {@link ASTNode} .
+ * @throws IllegalStateException
+ * this method may not be invoked at runtime. It works via a compile-time transformation
+ * of the closure source code into a String, which is sent to the {@link AstBuilder#buildFromString(CompilePhase, boolean, String)}
+ * method. The buildFromCode() method must be invoked against a strongly typed AstBuilder.
+ */
+ List<ASTNode> buildFromCode(CompilePhase phase = CompilePhase.CLASS_GENERATION, boolean statementsOnly = true, Closure block) {
+ throw new IllegalStateException("""AstBuilder.build(CompilePhase, boolean, Closure):List<ASTNode> should never be called at runtime.
+Are you sure you are using it correctly?
+""")
+ }
+
+
+ /**
+ * Builds AST based on the code within the String parameter.
+ *
+ * @param phase
+ * the {@link CompilePhase} the AST will be targeted towards. Default is {@link CompilePhase#CLASS_GENERATION}
+ * @param statementsOnly
+ * when true, only the script statements are returned. WHen false, you will
+ * receive back a Script class node also. Default is true.
+ * @param source
+ * The source code String that will be compiled.
+ * @returns a List of {@link ASTNode} .
+ * @throws IllegalArgumentException
+ * if source is null or empty
+ */
+ List<ASTNode> buildFromString(CompilePhase phase = CompilePhase.CLASS_GENERATION, boolean statementsOnly = true, String source) {
+ if (!source || "" == source.trim()) throw new IllegalArgumentException("A source must be specified")
+ return new AstStringCompiler().compile(source, phase, statementsOnly);
+ }
+
+ /**
+ * Builds AST based on the code within the String parameter. The parameter is assumed to be
+ * a code block which is not legal Groovy code. A goto label is affixed to the block, compiled,
+ * and the resulting BlockStatement wrapper is removed before returning a result.
+ * @param phase
+ * the {@link CompilePhase} the AST will be targeted towards. Default is {@link CompilePhase#CLASS_GENERATION}
+ * @param statementsOnly
+ * when true, only the script statements are returned. WHen false, you will
+ * receive back a Script class node also. Default is true.
+ * @param source
+ * The source code String that will be compiled. The string must be a block wrapped in curly braces.
+ * @returns a List of {@link ASTNode} .
+ * @throws IllegalArgumentException
+ * if source is null or empty
+ */
+ private List<ASTNode> buildFromBlock(CompilePhase phase = CompilePhase.CLASS_GENERATION, boolean statementsOnly = true, String source) {
+ if (!source || "" == source.trim()) throw new IllegalArgumentException("A source must be specified")
+ def labelledSource = "__synthesized__label__${System.currentTimeMillis()}__:" + source
+ List<ASTNode> result = new AstStringCompiler().compile(labelledSource, phase, statementsOnly)
+ // find the block statement from the result, and unwrap it from one level.
+ result.collect { node ->
+ if (node instanceof BlockStatement) {
+ ((BlockStatement)node).statements[0] //unwrap the artifact of pre-pending the goto label
+ } else {
+ node
+ }
+ }
+ }
+
+ /**
+ * Builds AST based on the DSL data within the Closure parameter.
+ * @param specification
+ * the contents to create
+ */
+ List<ASTNode> buildFromSpec(@DelegatesTo(AstSpecificationCompiler) Closure specification) {
+ if (specification == null) throw new IllegalArgumentException('Null: specification')
+ def properties = new AstSpecificationCompiler(specification)
+ return properties.expression
+ }
+}
\ No newline at end of file