commit_id
stringlengths
40
40
project
stringclasses
11 values
commit_message
stringlengths
3
3.04k
type
stringclasses
3 values
url
stringclasses
11 values
git_diff
stringlengths
555
691k
013fd99d0dd0df30e0bb7fcb98e41cd1633319cb
hbase
HBASE-2513 hbase-2414 added bug where we'd- tight-loop if no root available--git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@941546 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/hbase
diff --git a/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java b/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java index c85c1414b086..3749805ccc2d 100644 --- a/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java +++ b/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java @@ -122,8 +122,8 @@ public synchronized ProcessingResultCode process(final HServerAddress rootRegion // it first. if (rootRegionLocation != null) { op = delayedToDoQueue.poll(); - } else { - // if there aren't any todo items in the queue, sleep for a bit. + } + if (op == null) { try { op = toDoQueue.poll(threadWakeFrequency, TimeUnit.MILLISECONDS); } catch (InterruptedException e) {
5dbf97fd3d868f6db605fcf3b1a82bb55c47fed1
drools
[BZ-1042867] fix ProjectClassLoader when running in- osgi--
c
https://github.com/kiegroup/drools
diff --git a/drools-core/src/main/java/org/drools/core/common/ProjectClassLoader.java b/drools-core/src/main/java/org/drools/core/common/ProjectClassLoader.java index 51c0ad48c57..aacc316afcb 100644 --- a/drools-core/src/main/java/org/drools/core/common/ProjectClassLoader.java +++ b/drools-core/src/main/java/org/drools/core/common/ProjectClassLoader.java @@ -68,15 +68,11 @@ private static ProjectClassLoader internalCreate(ClassLoader parent) { public static ClassLoader getClassLoader(final ClassLoader classLoader, final Class< ? > cls, final boolean enableCache) { - if (classLoader == null) { - return cls == null ? createProjectClassLoader() : createProjectClassLoader(cls.getClassLoader()); - } else { - ProjectClassLoader projectClassLoader = createProjectClassLoader(classLoader); - if (cls != null) { - projectClassLoader.setDroolsClassLoader(cls.getClassLoader()); - } - return projectClassLoader; + ProjectClassLoader projectClassLoader = createProjectClassLoader(classLoader); + if (cls != null) { + projectClassLoader.setDroolsClassLoader(cls.getClassLoader()); } + return projectClassLoader; } public static ProjectClassLoader createProjectClassLoader() {
fbe88fe1a56907fae90cdf3ebf8c9fb1e12c7d09
intellij-community
form scope provider & dom lookups implemented--
a
https://github.com/JetBrains/intellij-community
diff --git a/codeInsight/impl/com/intellij/codeInsight/lookup/LookupValueFactory.java b/codeInsight/impl/com/intellij/codeInsight/lookup/LookupValueFactory.java new file mode 100644 index 0000000000000..b0a5173f0c3a7 --- /dev/null +++ b/codeInsight/impl/com/intellij/codeInsight/lookup/LookupValueFactory.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2000-2006 JetBrains s.r.o. All Rights Reserved. + */ + +package com.intellij.codeInsight.lookup; + +import com.intellij.openapi.util.Iconable; + +import javax.swing.*; + +/** + * @author Dmitry Avdeev + */ +public class LookupValueFactory { + + private LookupValueFactory() { + } + + public static Object createLookupValue(String name, Icon icon) { + return new LookupValueWithIcon(name, icon); + } + + public static class LookupValueWithIcon implements PresentableLookupValue, Iconable { + private final String myName; + private final Icon myIcon; + + protected LookupValueWithIcon(String name, Icon icon) { + + myName = name; + myIcon = icon; + } + public String getPresentation() { + return myName; + } + + public Icon getIcon(int flags) { + return myIcon; + } + } +} diff --git a/dom/impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java b/dom/impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java index 36fed9058e15f..a25ddc29270d7 100644 --- a/dom/impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java +++ b/dom/impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java @@ -4,7 +4,6 @@ package com.intellij.util.xml.impl; import com.intellij.javaee.J2EEBundle; -import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiManager; @@ -14,13 +13,14 @@ import com.intellij.psi.impl.source.resolve.reference.impl.GenericReference; import com.intellij.psi.xml.XmlElement; import com.intellij.psi.xml.XmlTag; -import com.intellij.util.Function; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xml.*; +import com.intellij.codeInsight.lookup.LookupValueFactory; +import javax.swing.*; import java.util.Collection; import java.util.List; +import java.util.ArrayList; /** * author: lesya @@ -151,21 +151,18 @@ public Object[] getVariants() { final ResolvingConverter<T> resolvingConverter = (ResolvingConverter<T>)converter; final ConvertContext convertContext = new ConvertContextImpl(DomManagerImpl.getDomInvocationHandler(myGenericValue)); final Collection<T> variants = resolvingConverter.getVariants(convertContext); - if (!variants.isEmpty()) { - final Collection<String> strings = ContainerUtil.findAll(ContainerUtil.map(variants, new Function<T, String>() { - public String fun(final T s) { - return converter.toString(s, convertContext); - } - }), new Condition<String>() { - public boolean value(final String object) { - return object != null; - } - }); - if (!strings.isEmpty()) { - return strings.toArray(new String[strings.size()]); + ArrayList<Object> result = new ArrayList<Object>(variants.size()); + for (T variant: variants) { + String name = converter.toString(variant, convertContext); + if (name != null) { + Icon icon = ElementPresentationManager.getIcon(variant); + Object value = LookupValueFactory.createLookupValue(name, icon); + result.add(value); } } + return result.toArray(); } return super.getVariants(); } + } diff --git a/dom/openapi/src/com/intellij/util/xml/ResolvingConverter.java b/dom/openapi/src/com/intellij/util/xml/ResolvingConverter.java index 8122a7d58ce33..38f510059b21d 100644 --- a/dom/openapi/src/com/intellij/util/xml/ResolvingConverter.java +++ b/dom/openapi/src/com/intellij/util/xml/ResolvingConverter.java @@ -16,6 +16,8 @@ */ package com.intellij.util.xml; +import org.jetbrains.annotations.NotNull; + import java.util.Collection; import java.util.Arrays; import java.util.Collections; @@ -53,10 +55,12 @@ public String toString(final Boolean t, final ConvertContext context) { return t == null? null:t.toString(); } + @NotNull public Collection<Boolean> getVariants(final ConvertContext context) { return Arrays.asList(Boolean.FALSE, Boolean.TRUE); } }; + @NotNull Collection<T> getVariants(final ConvertContext context); } diff --git a/dom/openapi/src/com/intellij/util/xml/Scope.java b/dom/openapi/src/com/intellij/util/xml/Scope.java index 0b98d6282ac6f..65abd61e1c20c 100644 --- a/dom/openapi/src/com/intellij/util/xml/Scope.java +++ b/dom/openapi/src/com/intellij/util/xml/Scope.java @@ -3,9 +3,13 @@ */ package com.intellij.util.xml; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + /** * @author peter */ +@Retention(RetentionPolicy.RUNTIME) public @interface Scope { Class<? extends ScopeProvider> value(); } diff --git a/dom/openapi/src/com/intellij/util/xml/ScopeProvider.java b/dom/openapi/src/com/intellij/util/xml/ScopeProvider.java index f5bd88fd38551..6880c6b46cdbe 100644 --- a/dom/openapi/src/com/intellij/util/xml/ScopeProvider.java +++ b/dom/openapi/src/com/intellij/util/xml/ScopeProvider.java @@ -17,6 +17,7 @@ package com.intellij.util.xml; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Should be stateless, since its instances are cached. @@ -29,6 +30,6 @@ public interface ScopeProvider { * For uniqueness checking should return element, whose direct children names will be compared. Basically it's parameter element's parent: ParentScopeProvider. * For resolving should return element, whose all children will be searched */ - @NotNull DomElement getScope(@NotNull DomElement element); + @Nullable DomElement getScope(@NotNull DomElement element); }
527370f8c142d373c4543d0eb26cb2f0912ed9f0
camel
CAMEL-1320: Created gzip data format--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@756039 13f79535-47bb-0310-9956-ffa450edef68-
a
https://github.com/apache/camel
diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java index e2eba66852b99..24892a459aa40 100644 --- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java +++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java @@ -18,13 +18,12 @@ import java.util.zip.Deflater; -import org.w3c.dom.Node; - import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.dataformat.ArtixDSContentType; import org.apache.camel.model.dataformat.ArtixDSDataFormat; import org.apache.camel.model.dataformat.CsvDataFormat; import org.apache.camel.model.dataformat.DataFormatDefinition; +import org.apache.camel.model.dataformat.GzipDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.model.dataformat.JsonDataFormat; @@ -36,6 +35,7 @@ import org.apache.camel.model.dataformat.XMLSecurityDataFormat; import org.apache.camel.model.dataformat.XStreamDataFormat; import org.apache.camel.model.dataformat.ZipDataFormat; +import org.w3c.dom.Node; /** * An expression for constructing the different possible {@link org.apache.camel.spi.DataFormat} @@ -242,6 +242,14 @@ public T zip(int compressionLevel) { ZipDataFormat zdf = new ZipDataFormat(compressionLevel); return dataFormat(zdf); } + + /** + * Uses the GZIP deflater data format + */ + public T gzip() { + GzipDataFormat gzdf = new GzipDataFormat(); + return dataFormat(gzdf); + } @SuppressWarnings("unchecked") private T dataFormat(DataFormatDefinition dataFormatType) { diff --git a/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java b/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java new file mode 100644 index 0000000000000..57cc53e148529 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java @@ -0,0 +1,59 @@ +/** + * 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.apache.camel.impl; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import org.apache.camel.Exchange; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.util.ExchangeHelper; +import org.apache.camel.util.IOHelper; + +public class GzipDataFormat implements DataFormat { + + public void marshal(Exchange exchange, Object graph, OutputStream stream) + throws Exception { + InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, graph); + if (is == null) { + throw new IllegalArgumentException("Cannot get the inputstream for GzipDataFormat mashalling"); + } + + GZIPOutputStream zipOutput = new GZIPOutputStream(stream); + try { + IOHelper.copy(is, zipOutput); + } finally { + zipOutput.close(); + } + + } + + public Object unmarshal(Exchange exchange, InputStream stream) + throws Exception { + InputStream is = ExchangeHelper.getMandatoryInBody(exchange, InputStream.class); + GZIPInputStream unzipInput = new GZIPInputStream(is); + + // Create an expandable byte array to hold the inflated data + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + IOHelper.copy(unzipInput, bos); + return bos.toByteArray(); + } + +} diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/GzipDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/GzipDataFormat.java new file mode 100644 index 0000000000000..864c347a9eac4 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/GzipDataFormat.java @@ -0,0 +1,35 @@ +/** + * 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.apache.camel.model.dataformat; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.RouteContext; + +/** + * Represents the GZip {@link DataFormat} + * + * @version $Revision: 750806 $ + */ +@XmlRootElement(name = "gzip") +public class GzipDataFormat extends DataFormatDefinition { + @Override + protected DataFormat createDataFormat(RouteContext routeContext) { + return new org.apache.camel.impl.GzipDataFormat(); + } +} diff --git a/camel-core/src/test/java/org/apache/camel/impl/GzipDataFormatTest.java b/camel-core/src/test/java/org/apache/camel/impl/GzipDataFormatTest.java new file mode 100644 index 0000000000000..16b1b8393669e --- /dev/null +++ b/camel-core/src/test/java/org/apache/camel/impl/GzipDataFormatTest.java @@ -0,0 +1,75 @@ +/** + * 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.apache.camel.impl; + +import java.io.ByteArrayInputStream; +import java.util.zip.GZIPInputStream; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.converter.IOConverter; + +/** + * Unit test of the gzip data format. + */ +public class GzipDataFormatTest extends ContextTestSupport { + private static final String TEXT = "Hamlet by William Shakespeare\n" + + "To be, or not to be: that is the question:\n" + + "Whether 'tis nobler in the mind to suffer\n" + + "The slings and arrows of outrageous fortune,\n" + + "Or to take arms against a sea of troubles,\n" + + "And by opposing end them? To die: to sleep;";; + + @Override + public boolean isUseRouteBuilder() { + return false; + } + + private byte[] sendText() throws Exception { + return (byte[]) template.sendBody("direct:start", TEXT.getBytes("UTF-8")); + } + + public void testMarshalTextToGZip() throws Exception { + context.addRoutes(new RouteBuilder() { + public void configure() { + from("direct:start").marshal().gzip(); + } + }); + context.start(); + + byte[] output = sendText(); + + GZIPInputStream stream = new GZIPInputStream(new ByteArrayInputStream(output)); + String result = IOConverter.toString(stream); + assertEquals("Uncompressed something different than compressed", TEXT, result); + } + + public void testUnMarshalTextToGzip() throws Exception { + context.addRoutes(new RouteBuilder() { + public void configure() { + from("direct:start").marshal().gzip().unmarshal().gzip().to("mock:result"); + } + }); + context.start(); + + MockEndpoint result = (MockEndpoint)context.getEndpoint("mock:result"); + result.expectedBodiesReceived(TEXT.getBytes("UTF-8")); + sendText(); + result.assertIsSatisfied(); + } +}
73282a316e9b28a3854ff93b6fd95789d9cd40ef
restlet-framework-java
JAX-RS-Extension: - encoding of UriBuilder- parameters implemented--
a
https://github.com/restlet/restlet-framework-java
diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/core/JaxRsUriBuilder.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/core/JaxRsUriBuilder.java index 3d36bc397d..8158f6639f 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/core/JaxRsUriBuilder.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/core/JaxRsUriBuilder.java @@ -74,6 +74,7 @@ public String resolve(String variableName) { "The given array contains null value at position (" + i + ")"); varValue = value.toString(); + varValue = EncodeOrCheck.all(varValue, encode); i++; retrievedValues.put(variableName, varValue); } @@ -178,7 +179,7 @@ private void addValidPathSegments(List<CharSequence> newPathSegments) { */ @Override public URI build() throws UriBuilderException { - Template template = new Template(toStringWithCheck(true)); + Template template = new Template(toStringWithCheck(false)); return buildUri(template.format(NO_VAR_RESOLVER)); } @@ -204,7 +205,6 @@ public URI build() throws UriBuilderException { @SuppressWarnings("unchecked") public URI build(final Map<String, Object> values) throws IllegalArgumentException, UriBuilderException { - // TODO encode values Template template = new Template(toStringWithCheck(false)); return buildUri(template.format(new Resolver<String>() { public String resolve(String variableName) { @@ -213,7 +213,7 @@ public String resolve(String variableName) { throw new IllegalArgumentException( "The value Map must contain a value for all given Templet variables. The value for variable " + variableName + " is missing"); - return varValue.toString(); + return EncodeOrCheck.all(varValue.toString(), encode); } })); } @@ -252,7 +252,6 @@ public URI build(Object... values) throws IllegalArgumentException, } Template template = new Template(toStringWithCheck(false)); return buildUri(template.format(new IteratorVariableResolver(values))); - // TODO encode values } /** diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/EncodeOrCheck.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/EncodeOrCheck.java index c7c9d0f357..06091beec4 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/EncodeOrCheck.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/EncodeOrCheck.java @@ -532,4 +532,29 @@ else if (c == '%') { return stb; // LATER userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) } + + /** + * @param string + * @param encode + * @return + */ + public static String all(CharSequence string, boolean encode) { + int length = string.length(); + StringBuilder stb = new StringBuilder(length); + for (int i = 0; i < length; i++) { + char c = string.charAt(i); + if (Reference.isValid(c)) + stb.append(c); + else if (c == '%') { + if (encode) + toHex(c, stb); + else { + checkForHexDigitAndAppend(string, i, stb); + i += 2; + } + } else + toHexOrReject(c, stb, encode); + } + return stb.toString(); + } } \ No newline at end of file
c4030850a057ed3cd8aedce4ea49147cd10a1798
restlet-framework-java
- All core representation classes have been moved- from the "org.restlet.resource" package into a new- "org.restlet.representation" package. Make sure to adjust your import- instructions.--
p
https://github.com/restlet/restlet-framework-java
diff --git a/build/tmpl/eclipse/dictionary.xml b/build/tmpl/eclipse/dictionary.xml new file mode 100644 index 0000000000..241926202d --- /dev/null +++ b/build/tmpl/eclipse/dictionary.xml @@ -0,0 +1,12 @@ +servlet +restlet +restlets +org +servlets +jerome +louvel +xml +webapp +href +standalone +microsystems diff --git a/build/tmpl/text/changes.txt b/build/tmpl/text/changes.txt index c90070e225..228eb8b108 100644 --- a/build/tmpl/text/changes.txt +++ b/build/tmpl/text/changes.txt @@ -6,7 +6,11 @@ Changes log - @version-full@ (@release-date@) - Breaking changes - Finder#createTarget() methods are now all protected. The - findTarget() method is now public. Suggested by Leigh Klotz. + findTarget() method is now public. Suggested by Leigh Klotz. + - All core representation classes have been moved from the + "org.restlet.resource" package into a new + "org.restlet.representation" package. Make sure to adjust your + import instructions. - Enhancements - Added a getItemIterator() on RestletFileUpload to facilitate access to parts in streaming mode. Suggested by Paul Austin. diff --git a/modules/org.restlet.example/META-INF/MANIFEST.MF b/modules/org.restlet.example/META-INF/MANIFEST.MF index 9772932f99..a48cd80134 100644 --- a/modules/org.restlet.example/META-INF/MANIFEST.MF +++ b/modules/org.restlet.example/META-INF/MANIFEST.MF @@ -76,6 +76,7 @@ Import-Package: com.db4o, org.restlet.ext.jibx, org.restlet.ext.json, org.restlet.ext.velocity, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util, diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_1a.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_1a.java index 0b66a49b2b..04e6dbf3d0 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_1a.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_1a.java @@ -31,7 +31,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Reference; import org.restlet.data.Response; -import org.restlet.resource.DomRepresentation; +import org.restlet.representation.DomRepresentation; import org.w3c.dom.Node; /** diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_1b.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_1b.java index 014c0f49d3..cbae2c574c 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_1b.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_1b.java @@ -31,7 +31,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Reference; import org.restlet.data.Response; -import org.restlet.resource.DomRepresentation; +import org.restlet.representation.DomRepresentation; import org.w3c.dom.Node; /** diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_5.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_5.java index c73e4e4c60..03b3082b01 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_5.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch2/Example2_5.java @@ -34,7 +34,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.DomRepresentation; +import org.restlet.representation.DomRepresentation; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3App.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3App.java index e938ba7cc6..9500e3fadb 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3App.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3App.java @@ -31,7 +31,7 @@ import java.util.List; import org.restlet.data.Response; -import org.restlet.resource.DomRepresentation; +import org.restlet.representation.DomRepresentation; import org.w3c.dom.Node; /** diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Authorized.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Authorized.java index 98ce3c09d1..f971fa0e0b 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Authorized.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Authorized.java @@ -34,7 +34,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Amazon S3 client. Support class handling authorized requests. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Bucket.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Bucket.java index d3168cc2db..1513387185 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Bucket.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Bucket.java @@ -32,7 +32,7 @@ import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.DomRepresentation; +import org.restlet.representation.DomRepresentation; import org.w3c.dom.Node; /** diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Object.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Object.java index 67c59a8911..8b133b978b 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Object.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch3/S3Object.java @@ -29,8 +29,8 @@ import org.restlet.data.Reference; import org.restlet.data.Status; -import org.restlet.resource.Representation; -import org.restlet.resource.Variant; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; /** * Amazon S3 object. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/BookmarkResource.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/BookmarkResource.java index 9e5e90e41d..338c0ea18a 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/BookmarkResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/BookmarkResource.java @@ -35,10 +35,10 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Resource for a user's bookmark. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/BookmarksResource.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/BookmarksResource.java index d7dca6fb6d..59748ce2af 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/BookmarksResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/BookmarksResource.java @@ -33,9 +33,9 @@ import org.restlet.data.ReferenceList; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a user's list of bookmarks. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/UserResource.java b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/UserResource.java index da67a04327..1d3bc39d16 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/UserResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/rest/ch7/UserResource.java @@ -38,11 +38,11 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; import com.db4o.ObjectContainer; import com.db4o.query.Predicate; diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/BasicSmtpClient.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/BasicSmtpClient.java index 98f228aff4..bdf5a4bea5 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/BasicSmtpClient.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/BasicSmtpClient.java @@ -35,8 +35,8 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/CookiesRestlet.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/CookiesRestlet.java index 963e7c74fb..c373883cf9 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/CookiesRestlet.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/CookiesRestlet.java @@ -35,7 +35,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/DomResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/DomResource.java index 5e91f6432e..da20685280 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/DomResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/DomResource.java @@ -34,11 +34,11 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; import org.w3c.dom.Document; import org.w3c.dom.Element; diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/FreemarkerResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/FreemarkerResource.java index 8adcd841d6..4b3e4e4926 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/FreemarkerResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/FreemarkerResource.java @@ -38,10 +38,10 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.ext.freemarker.TemplateRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/NonStandardMethodsResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/NonStandardMethodsResource.java index 22d2506d71..28f5de55cb 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/NonStandardMethodsResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/NonStandardMethodsResource.java @@ -28,8 +28,8 @@ package org.restlet.example.book.restlet.ch10; import org.restlet.data.Status; +import org.restlet.representation.StringRepresentation; import org.restlet.resource.Resource; -import org.restlet.resource.StringRepresentation; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/SampleComponent.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/SampleComponent.java index ee1fe9d7d0..2989befe3d 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/SampleComponent.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/SampleComponent.java @@ -35,9 +35,9 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.SaxRepresentation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.SaxRepresentation; +import org.restlet.representation.StringRepresentation; import org.restlet.util.NodeSet; import org.w3c.dom.Node; import org.xml.sax.Attributes; diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/SaxResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/SaxResource.java index c4ba20873f..41137b843a 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/SaxResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/SaxResource.java @@ -31,11 +31,11 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.SaxRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.SaxRepresentation; -import org.restlet.resource.Variant; import org.restlet.util.XmlWriter; import org.xml.sax.SAXException; diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/TransformerResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/TransformerResource.java index 3609a68adc..adb76224ba 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/TransformerResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/TransformerResource.java @@ -33,12 +33,12 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.FileRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.FileRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.TransformRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.TransformRepresentation; -import org.restlet.resource.Variant; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/TunnelApplication.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/TunnelApplication.java index a8c53c921c..137a030472 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/TunnelApplication.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/TunnelApplication.java @@ -35,7 +35,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/VelocityResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/VelocityResource.java index 9c5176b8a2..01fb224a89 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/VelocityResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch10/VelocityResource.java @@ -38,10 +38,10 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.ext.velocity.TemplateRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch11/BasicSmtpStartTlsClient.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch11/BasicSmtpStartTlsClient.java index 109328e3f8..261913da8a 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch11/BasicSmtpStartTlsClient.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch11/BasicSmtpStartTlsClient.java @@ -37,8 +37,8 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch11/BasicSmtpsClient.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch11/BasicSmtpsClient.java index 4a68e9f0b1..77ce7a7c1c 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch11/BasicSmtpsClient.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch11/BasicSmtpsClient.java @@ -37,8 +37,8 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch4/HelloWorldResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch4/HelloWorldResource.java index 7895a27cf8..9a14a75244 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch4/HelloWorldResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch4/HelloWorldResource.java @@ -31,11 +31,11 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/BaseResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/BaseResource.java index d78399bfd2..dfc4da9207 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/BaseResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/BaseResource.java @@ -39,7 +39,7 @@ import org.restlet.example.book.restlet.ch8.objects.ObjectsFacade; import org.restlet.example.book.restlet.ch8.objects.User; import org.restlet.ext.freemarker.TemplateRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.resource.Resource; import freemarker.template.Configuration; diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/ContactResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/ContactResource.java index 9bca342314..1134447f3e 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/ContactResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/ContactResource.java @@ -39,9 +39,9 @@ import org.restlet.data.Response; import org.restlet.example.book.restlet.ch8.objects.Contact; import org.restlet.example.book.restlet.ch8.objects.Mailbox; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a user's contact. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/ContactsResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/ContactsResource.java index b8b58a2e78..d18534a57b 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/ContactsResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/ContactsResource.java @@ -39,9 +39,9 @@ import org.restlet.data.Response; import org.restlet.example.book.restlet.ch8.objects.Contact; import org.restlet.example.book.restlet.ch8.objects.Mailbox; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a list of contacts. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/FeedResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/FeedResource.java index 28a5983a22..4c8c0649c8 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/FeedResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/FeedResource.java @@ -54,10 +54,10 @@ import org.restlet.ext.atom.Person; import org.restlet.ext.atom.Relation; import org.restlet.ext.atom.Text; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/FeedsResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/FeedsResource.java index bbf355113c..10e8ce03d0 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/FeedsResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/FeedsResource.java @@ -40,9 +40,9 @@ import org.restlet.data.Response; import org.restlet.example.book.restlet.ch8.objects.Feed; import org.restlet.example.book.restlet.ch8.objects.Mailbox; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a list of feeds. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailResource.java index b10e07373e..d88f159e38 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailResource.java @@ -47,9 +47,9 @@ import org.restlet.example.book.restlet.ch8.objects.Contact; import org.restlet.example.book.restlet.ch8.objects.Mail; import org.restlet.example.book.restlet.ch8.objects.Mailbox; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a mail. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailRootResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailRootResource.java index 1811d2c4d4..8352f2db97 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailRootResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailRootResource.java @@ -34,9 +34,9 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for the mail application. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailboxResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailboxResource.java index 84c9a2cf4c..9e41a6e90d 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailboxResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailboxResource.java @@ -41,9 +41,9 @@ import org.restlet.example.book.restlet.ch8.objects.Contact; import org.restlet.example.book.restlet.ch8.objects.Mail; import org.restlet.example.book.restlet.ch8.objects.Mailbox; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; import org.restlet.util.Series; /** diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailboxesResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailboxesResource.java index 3a305c705d..ff6b20e154 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailboxesResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailboxesResource.java @@ -40,9 +40,9 @@ import org.restlet.example.book.restlet.ch8.objects.Mailbox; import org.restlet.example.book.restlet.ch8.objects.ObjectsException; import org.restlet.example.book.restlet.ch8.objects.User; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a list of mailboxes. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailsResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailsResource.java index 240c997484..2f5e46a388 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailsResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/MailsResource.java @@ -43,9 +43,9 @@ import org.restlet.example.book.restlet.ch8.objects.Contact; import org.restlet.example.book.restlet.ch8.objects.Mail; import org.restlet.example.book.restlet.ch8.objects.Mailbox; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a list of mails. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/UserResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/UserResource.java index 199dab974c..70523f541b 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/UserResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/UserResource.java @@ -39,9 +39,9 @@ import org.restlet.data.Response; import org.restlet.example.book.restlet.ch8.objects.Mailbox; import org.restlet.example.book.restlet.ch8.objects.User; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a user. diff --git a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/UsersResource.java b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/UsersResource.java index 88c35eb996..8312984081 100644 --- a/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/UsersResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/book/restlet/ch8/resources/UsersResource.java @@ -39,9 +39,9 @@ import org.restlet.data.Response; import org.restlet.example.book.restlet.ch8.objects.ObjectsException; import org.restlet.example.book.restlet.ch8.objects.User; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource for a list of users. diff --git a/modules/org.restlet.example/src/org/restlet/example/misc/AwsTest.java b/modules/org.restlet.example/src/org/restlet/example/misc/AwsTest.java index 798afa4a34..4a1621a7bd 100644 --- a/modules/org.restlet.example/src/org/restlet/example/misc/AwsTest.java +++ b/modules/org.restlet.example/src/org/restlet/example/misc/AwsTest.java @@ -36,7 +36,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Series; /** diff --git a/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/BookmarkResource.java b/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/BookmarkResource.java index 37184114f3..3271c7cf70 100644 --- a/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/BookmarkResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/BookmarkResource.java @@ -36,9 +36,9 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.example.book.rest.ch7.Bookmark; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; /** * Resource for a user's bookmark. diff --git a/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/BookmarksResource.java b/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/BookmarksResource.java index 02d807c21f..c4fee24fdb 100644 --- a/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/BookmarksResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/BookmarksResource.java @@ -34,8 +34,8 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.example.book.rest.ch7.Bookmark; -import org.restlet.resource.Representation; -import org.restlet.resource.Variant; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; /** * Resource for a user's list of bookmarks. diff --git a/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/UserResource.java b/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/UserResource.java index 8659e20cf4..2b81ed0d9c 100644 --- a/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/UserResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/spring/book/rest/ch7/UserResource.java @@ -40,10 +40,10 @@ import org.restlet.data.Status; import org.restlet.example.book.rest.ch7.Bookmark; import org.restlet.example.book.rest.ch7.User; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; import com.db4o.ObjectContainer; import com.db4o.query.Predicate; diff --git a/modules/org.restlet.example/src/org/restlet/example/tutorial/OrderResource.java b/modules/org.restlet.example/src/org/restlet/example/tutorial/OrderResource.java index 62185a68cc..aa014940ef 100644 --- a/modules/org.restlet.example/src/org/restlet/example/tutorial/OrderResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/tutorial/OrderResource.java @@ -31,10 +31,10 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Related to the part 12 of the tutorial. diff --git a/modules/org.restlet.example/src/org/restlet/example/tutorial/OrdersResource.java b/modules/org.restlet.example/src/org/restlet/example/tutorial/OrdersResource.java index 37972eb430..931748de45 100644 --- a/modules/org.restlet.example/src/org/restlet/example/tutorial/OrdersResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/tutorial/OrdersResource.java @@ -31,10 +31,10 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Related to the part 12 of the tutorial. diff --git a/modules/org.restlet.example/src/org/restlet/example/tutorial/Part02b.java b/modules/org.restlet.example/src/org/restlet/example/tutorial/Part02b.java index fb9ff4c2c4..d3f72489d1 100644 --- a/modules/org.restlet.example/src/org/restlet/example/tutorial/Part02b.java +++ b/modules/org.restlet.example/src/org/restlet/example/tutorial/Part02b.java @@ -32,7 +32,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Retrieving the content of a Web page (detailled). diff --git a/modules/org.restlet.example/src/org/restlet/example/tutorial/UserResource.java b/modules/org.restlet.example/src/org/restlet/example/tutorial/UserResource.java index 02d3629f22..b7ab72e911 100644 --- a/modules/org.restlet.example/src/org/restlet/example/tutorial/UserResource.java +++ b/modules/org.restlet.example/src/org/restlet/example/tutorial/UserResource.java @@ -31,11 +31,11 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Related to the part 12 of the tutorial. diff --git a/modules/org.restlet.ext.atom_1.0/META-INF/MANIFEST.MF b/modules/org.restlet.ext.atom_1.0/META-INF/MANIFEST.MF index 6ad0f86fd6..7f6e784310 100644 --- a/modules/org.restlet.ext.atom_1.0/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.atom_1.0/META-INF/MANIFEST.MF @@ -12,6 +12,7 @@ Export-Package: org.restlet.ext.atom; Import-Package: org.restlet, org.restlet.data, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Collection.java b/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Collection.java index e66e2b494a..b40f667613 100644 --- a/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Collection.java +++ b/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Collection.java @@ -35,7 +35,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.XmlWriter; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; diff --git a/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Content.java b/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Content.java index 2e7ace43f1..f38a446fe7 100644 --- a/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Content.java +++ b/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Content.java @@ -33,7 +33,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Reference; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.XmlWriter; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; diff --git a/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Feed.java b/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Feed.java index bfe1dad7f4..aaecd0acaf 100644 --- a/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Feed.java +++ b/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Feed.java @@ -40,9 +40,9 @@ import org.restlet.data.Protocol; import org.restlet.data.Reference; import org.restlet.engine.util.DateUtils; -import org.restlet.resource.Representation; -import org.restlet.resource.SaxRepresentation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.SaxRepresentation; +import org.restlet.representation.StringRepresentation; import org.restlet.util.XmlWriter; import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Service.java b/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Service.java index 0c67ae8a0e..0daf5123df 100644 --- a/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Service.java +++ b/modules/org.restlet.ext.atom_1.0/src/org/restlet/ext/atom/Service.java @@ -39,8 +39,8 @@ import org.restlet.data.MediaType; import org.restlet.data.Reference; import org.restlet.data.Status; -import org.restlet.resource.Representation; -import org.restlet.resource.SaxRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.SaxRepresentation; import org.restlet.util.XmlWriter; import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/modules/org.restlet.ext.fileupload_1.2/META-INF/MANIFEST.MF b/modules/org.restlet.ext.fileupload_1.2/META-INF/MANIFEST.MF index 6d25b32fe1..b4de261b79 100644 --- a/modules/org.restlet.ext.fileupload_1.2/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.fileupload_1.2/META-INF/MANIFEST.MF @@ -10,6 +10,7 @@ Import-Package: javax.servlet;resolution:=optional, org.apache.commons.fileupload, org.restlet, org.restlet.data, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.fileupload_1.2/src/org/restlet/ext/fileupload/RepresentationContext.java b/modules/org.restlet.ext.fileupload_1.2/src/org/restlet/ext/fileupload/RepresentationContext.java index a243c6c2f7..5c4fec3e44 100644 --- a/modules/org.restlet.ext.fileupload_1.2/src/org/restlet/ext/fileupload/RepresentationContext.java +++ b/modules/org.restlet.ext.fileupload_1.2/src/org/restlet/ext/fileupload/RepresentationContext.java @@ -31,7 +31,7 @@ import java.io.InputStream; import org.apache.commons.fileupload.RequestContext; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Provides access to the representation information needed by the FileUpload diff --git a/modules/org.restlet.ext.fileupload_1.2/src/org/restlet/ext/fileupload/RestletFileUpload.java b/modules/org.restlet.ext.fileupload_1.2/src/org/restlet/ext/fileupload/RestletFileUpload.java index 90a8b51c4a..77f9ef459a 100644 --- a/modules/org.restlet.ext.fileupload_1.2/src/org/restlet/ext/fileupload/RestletFileUpload.java +++ b/modules/org.restlet.ext.fileupload_1.2/src/org/restlet/ext/fileupload/RestletFileUpload.java @@ -36,7 +36,7 @@ import org.apache.commons.fileupload.FileUpload; import org.apache.commons.fileupload.FileUploadException; import org.restlet.data.Request; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * High level API for processing file uploads. This class handles multiple files diff --git a/modules/org.restlet.ext.freemarker_2.3/META-INF/MANIFEST.MF b/modules/org.restlet.ext.freemarker_2.3/META-INF/MANIFEST.MF index f8dbd3c14b..aa4b2075e0 100644 --- a/modules/org.restlet.ext.freemarker_2.3/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.freemarker_2.3/META-INF/MANIFEST.MF @@ -12,6 +12,7 @@ Export-Package: org.restlet.ext.freemarker; Import-Package: freemarker.template, org.restlet, org.restlet.data, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.freemarker_2.3/src/org/restlet/ext/freemarker/TemplateFilter.java b/modules/org.restlet.ext.freemarker_2.3/src/org/restlet/ext/freemarker/TemplateFilter.java index 5d1bfce352..84d2acb7b7 100644 --- a/modules/org.restlet.ext.freemarker_2.3/src/org/restlet/ext/freemarker/TemplateFilter.java +++ b/modules/org.restlet.ext.freemarker_2.3/src/org/restlet/ext/freemarker/TemplateFilter.java @@ -39,9 +39,8 @@ /** * Filter response's entity and wrap it with a FreeMarker's template - * representation.<br> - * By default, the template representation provides a data model based on the - * request and response objects.<br> + * representation. By default, the template representation provides a data model + * based on the request and response objects.<br> * * Concurrency note: instances of this class or its subclasses can be invoked by * several threads at the same time and therefore must be thread-safe. You diff --git a/modules/org.restlet.ext.freemarker_2.3/src/org/restlet/ext/freemarker/TemplateRepresentation.java b/modules/org.restlet.ext.freemarker_2.3/src/org/restlet/ext/freemarker/TemplateRepresentation.java index 75f6fa3248..ecc99f7eeb 100644 --- a/modules/org.restlet.ext.freemarker_2.3/src/org/restlet/ext/freemarker/TemplateRepresentation.java +++ b/modules/org.restlet.ext.freemarker_2.3/src/org/restlet/ext/freemarker/TemplateRepresentation.java @@ -38,8 +38,8 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.OutputRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.OutputRepresentation; +import org.restlet.representation.Representation; import org.restlet.util.Resolver; import freemarker.template.Configuration; diff --git a/modules/org.restlet.ext.httpclient_3.1/META-INF/MANIFEST.MF b/modules/org.restlet.ext.httpclient_3.1/META-INF/MANIFEST.MF index a456d2c6fb..287156048b 100644 --- a/modules/org.restlet.ext.httpclient_3.1/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.httpclient_3.1/META-INF/MANIFEST.MF @@ -29,6 +29,7 @@ Import-Package: org.apache.commons.codec, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.httpclient_3.1/src/org/restlet/ext/httpclient/HttpMethodCall.java b/modules/org.restlet.ext.httpclient_3.1/src/org/restlet/ext/httpclient/HttpMethodCall.java index 4107529395..665d81fe79 100644 --- a/modules/org.restlet.ext.httpclient_3.1/src/org/restlet/ext/httpclient/HttpMethodCall.java +++ b/modules/org.restlet.ext.httpclient_3.1/src/org/restlet/ext/httpclient/HttpMethodCall.java @@ -58,7 +58,7 @@ import org.restlet.data.Status; import org.restlet.engine.Engine; import org.restlet.engine.http.HttpClientCall; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Series; diff --git a/modules/org.restlet.ext.javamail_1.4/META-INF/MANIFEST.MF b/modules/org.restlet.ext.javamail_1.4/META-INF/MANIFEST.MF index ed3a37650a..34fc678a91 100644 --- a/modules/org.restlet.ext.javamail_1.4/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.javamail_1.4/META-INF/MANIFEST.MF @@ -25,6 +25,7 @@ Import-Package: com.sun.mail.handlers, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/JavaMailClientHelper.java b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/JavaMailClientHelper.java index e329d97633..b4701b830e 100644 --- a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/JavaMailClientHelper.java +++ b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/JavaMailClientHelper.java @@ -51,7 +51,7 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.engine.ClientHelper; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.w3c.dom.DOMException; import com.sun.mail.pop3.POP3Folder; diff --git a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MailResolver.java b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MailResolver.java index 23b4673025..7c1ebe7a5c 100644 --- a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MailResolver.java +++ b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MailResolver.java @@ -30,8 +30,8 @@ import java.util.HashMap; import java.util.Map; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; import org.restlet.util.Resolver; import org.w3c.dom.Node; import org.w3c.dom.NodeList; diff --git a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MessageRepresentation.java b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MessageRepresentation.java index 1500584a3b..53207d7118 100644 --- a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MessageRepresentation.java +++ b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MessageRepresentation.java @@ -39,9 +39,9 @@ import org.restlet.data.MediaType; import org.restlet.engine.http.ContentType; import org.restlet.engine.util.DateUtils; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.Representation; import org.w3c.dom.CDATASection; import org.w3c.dom.DOMException; import org.w3c.dom.Document; diff --git a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MessagesRepresentation.java b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MessagesRepresentation.java index 8e9ef3745c..0c728a6860 100644 --- a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MessagesRepresentation.java +++ b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/MessagesRepresentation.java @@ -33,7 +33,7 @@ import javax.mail.MessagingException; import org.restlet.data.MediaType; -import org.restlet.resource.DomRepresentation; +import org.restlet.representation.DomRepresentation; import org.w3c.dom.Document; import org.w3c.dom.Element; diff --git a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/RepresentationMessage.java b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/RepresentationMessage.java index 6bb7c77794..d8accf4a9c 100644 --- a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/RepresentationMessage.java +++ b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/RepresentationMessage.java @@ -37,8 +37,8 @@ import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; diff --git a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/TriggerResource.java b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/TriggerResource.java index a6b34dec96..ac4d47edcd 100644 --- a/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/TriggerResource.java +++ b/modules/org.restlet.ext.javamail_1.4/src/org/restlet/ext/javamail/TriggerResource.java @@ -40,11 +40,11 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; import org.restlet.util.Resolver; import org.restlet.util.Template; import org.w3c.dom.Node; diff --git a/modules/org.restlet.ext.jaxb_2.1/META-INF/MANIFEST.MF b/modules/org.restlet.ext.jaxb_2.1/META-INF/MANIFEST.MF index b57bdc15d0..1bc4d001ed 100644 --- a/modules/org.restlet.ext.jaxb_2.1/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.jaxb_2.1/META-INF/MANIFEST.MF @@ -11,6 +11,7 @@ Import-Package: javax.xml.bind;version="2.1.0", javax.xml.stream.util, org.restlet, org.restlet.data, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.jaxb_2.1/src/org/restlet/ext/jaxb/JaxbRepresentation.java b/modules/org.restlet.ext.jaxb_2.1/src/org/restlet/ext/jaxb/JaxbRepresentation.java index 7edce93984..5a8f8292e9 100644 --- a/modules/org.restlet.ext.jaxb_2.1/src/org/restlet/ext/jaxb/JaxbRepresentation.java +++ b/modules/org.restlet.ext.jaxb_2.1/src/org/restlet/ext/jaxb/JaxbRepresentation.java @@ -48,9 +48,9 @@ import org.restlet.Context; import org.restlet.data.MediaType; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.XmlRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.XmlRepresentation; import org.w3c.dom.Document; /** diff --git a/modules/org.restlet.ext.jaxrs_1.0/META-INF/MANIFEST.MF b/modules/org.restlet.ext.jaxrs_1.0/META-INF/MANIFEST.MF index e807f8f04e..d0f3ddd062 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.jaxrs_1.0/META-INF/MANIFEST.MF @@ -75,6 +75,7 @@ Import-Package: javax.activation;version="1.1.1", org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/JaxRsRestlet.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/JaxRsRestlet.java index c688db4632..7abe9f7365 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/JaxRsRestlet.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/JaxRsRestlet.java @@ -107,7 +107,7 @@ import org.restlet.ext.jaxrs.internal.wrappers.provider.JaxRsProviders; import org.restlet.ext.jaxrs.internal.wrappers.provider.MessageBodyWriter; import org.restlet.ext.jaxrs.internal.wrappers.provider.MessageBodyWriterSubSet; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.resource.ResourceException; import org.restlet.service.MetadataService; diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/core/CallContext.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/core/CallContext.java index ffa88756e5..5bb9703363 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/core/CallContext.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/core/CallContext.java @@ -79,7 +79,7 @@ import org.restlet.ext.jaxrs.internal.util.SecurityUtil; import org.restlet.ext.jaxrs.internal.util.SortedMetadata; import org.restlet.ext.jaxrs.internal.util.Util; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Contains all request specific data of the interfaces injectable for &#64; @@ -1215,9 +1215,9 @@ public Variant selectVariant(List<Variant> variants) if ((variants == null) || variants.isEmpty()) { throw new IllegalArgumentException(); } - final List<org.restlet.resource.Variant> restletVariants = Converter + final List<org.restlet.representation.Variant> restletVariants = Converter .toRestletVariants(variants); - final org.restlet.resource.Variant bestRestlVar = this.request + final org.restlet.representation.Variant bestRestlVar = this.request .getClientInfo().getPreferredVariant(restletVariants, null); final Variant bestVariant = Converter.toJaxRsVariant(bestRestlVar); final Set<Dimension> dimensions = this.response.getDimensions(); diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/ReaderProvider.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/ReaderProvider.java index b7c2b93289..a50710abcb 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/ReaderProvider.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/ReaderProvider.java @@ -46,7 +46,7 @@ import org.restlet.data.Response; import org.restlet.engine.io.ByteUtils; import org.restlet.ext.jaxrs.internal.util.Util; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * This ProviderWrapper is used to read directly from a {@link Reader}. diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/StringProvider.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/StringProvider.java index 3e218ec2ae..88c8c9ca61 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/StringProvider.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/StringProvider.java @@ -43,7 +43,7 @@ import org.restlet.data.CharacterSet; import org.restlet.data.Response; import org.restlet.ext.jaxrs.internal.util.Util; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * ProviderWrapper for {@link String}s. Could also write other diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/WwwFormFormProvider.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/WwwFormFormProvider.java index 1a0f64aa4f..a25ae874cf 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/WwwFormFormProvider.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/WwwFormFormProvider.java @@ -46,8 +46,8 @@ import org.restlet.data.Request; import org.restlet.ext.jaxrs.internal.util.Converter; import org.restlet.ext.jaxrs.internal.util.Util; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.Representation; /** * This {@link ProviderWrapper} converts Restlet {@link Form}s to diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/WwwFormMmapProvider.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/WwwFormMmapProvider.java index 32506df5d0..c99243768a 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/WwwFormMmapProvider.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/provider/WwwFormMmapProvider.java @@ -44,7 +44,7 @@ import org.restlet.ext.jaxrs.internal.core.UnmodifiableMultivaluedMap; import org.restlet.ext.jaxrs.internal.util.Converter; import org.restlet.ext.jaxrs.internal.util.Util; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * This {@link ProviderWrapper} converts MultivaluedMap&lt;String,String&gt; diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/Converter.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/Converter.java index af11998452..c9fbb91635 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/Converter.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/Converter.java @@ -261,7 +261,7 @@ public static NewCookie toJaxRsNewCookie(CookieSetting cookieSetting) * and one */ public static javax.ws.rs.core.Variant toJaxRsVariant( - org.restlet.resource.Variant restletVariant) + org.restlet.representation.Variant restletVariant) throws IllegalArgumentException { final MediaType mediaType = Converter.toJaxRsMediaType(restletVariant .getMediaType(), restletVariant.getCharacterSet()); @@ -446,12 +446,12 @@ public static Tag toRestletTag(EntityTag jaxRsEntityTag) { * @param jaxRsVariants * @return the List of Restlet Variants */ - public static List<org.restlet.resource.Variant> toRestletVariants( + public static List<org.restlet.representation.Variant> toRestletVariants( Collection<javax.ws.rs.core.Variant> jaxRsVariants) { - final List<org.restlet.resource.Variant> restletVariants = new ArrayList<org.restlet.resource.Variant>( + final List<org.restlet.representation.Variant> restletVariants = new ArrayList<org.restlet.representation.Variant>( jaxRsVariants.size()); for (final javax.ws.rs.core.Variant jaxRsVariant : jaxRsVariants) { - final org.restlet.resource.Variant restletVariant = new org.restlet.resource.Variant(); + final org.restlet.representation.Variant restletVariant = new org.restlet.representation.Variant(); restletVariant.setCharacterSet(getRestletCharacterSet(jaxRsVariant .getMediaType())); restletVariant.setEncodings(Util.createList(Encoding diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/JaxRsOutputRepresentation.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/JaxRsOutputRepresentation.java index 2feb750302..8249890902 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/JaxRsOutputRepresentation.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/JaxRsOutputRepresentation.java @@ -38,7 +38,7 @@ import org.restlet.data.MediaType; import org.restlet.ext.jaxrs.internal.wrappers.provider.MessageBodyWriter; -import org.restlet.resource.OutputRepresentation; +import org.restlet.representation.OutputRepresentation; /** * This representation is used to write the Representations with a @@ -97,7 +97,7 @@ public JaxRsOutputRepresentation(T object, Type genericType, } /** - * @see org.restlet.resource.Representation#write(java.io.OutputStream) + * @see org.restlet.representation.Representation#write(java.io.OutputStream) */ @Override public void write(OutputStream outputStream) throws IOException { diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/Util.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/Util.java index 0c3e54d30f..9971b7321c 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/Util.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/util/Util.java @@ -88,7 +88,7 @@ import org.restlet.ext.jaxrs.internal.exceptions.MethodInvokeException; import org.restlet.ext.jaxrs.internal.exceptions.MissingAnnotationException; import org.restlet.ext.jaxrs.internal.provider.JaxbElementProvider; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Series; /** diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/EntityGetter.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/EntityGetter.java index b1742e5b0e..e65fafca24 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/EntityGetter.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/EntityGetter.java @@ -43,7 +43,7 @@ import org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList.ParamGetter; import org.restlet.ext.jaxrs.internal.wrappers.provider.MessageBodyReader; import org.restlet.ext.jaxrs.internal.wrappers.provider.MessageBodyReaderSet; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * An EntityGetter converts the given entity from the request to the type diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/ParameterList.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/ParameterList.java index de9c9bbdff..e786bfb070 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/ParameterList.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/ParameterList.java @@ -83,7 +83,7 @@ import org.restlet.ext.jaxrs.internal.wrappers.WrapperUtil; import org.restlet.ext.jaxrs.internal.wrappers.provider.JaxRsProviders; import org.restlet.ext.jaxrs.internal.wrappers.provider.ExtensionBackwardMapping; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Series; /** diff --git a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/ReprEntityGetter.java b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/ReprEntityGetter.java index 716eb16c29..d5d7440491 100644 --- a/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/ReprEntityGetter.java +++ b/modules/org.restlet.ext.jaxrs_1.0/src/org/restlet/ext/jaxrs/internal/wrappers/params/ReprEntityGetter.java @@ -37,7 +37,7 @@ import org.restlet.data.Request; import org.restlet.ext.jaxrs.internal.exceptions.ConvertRepresentationException; import org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList.ParamGetter; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * An {@link EntityGetter} for Restlet {@link Representation}s. diff --git a/modules/org.restlet.ext.jdbc_3.0/META-INF/MANIFEST.MF b/modules/org.restlet.ext.jdbc_3.0/META-INF/MANIFEST.MF index 630a88a22c..f44ef8e536 100644 --- a/modules/org.restlet.ext.jdbc_3.0/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.jdbc_3.0/META-INF/MANIFEST.MF @@ -26,6 +26,7 @@ Import-Package: com.sun.rowset, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.jdbc_3.0/src/org/restlet/ext/jdbc/JdbcClientHelper.java b/modules/org.restlet.ext.jdbc_3.0/src/org/restlet/ext/jdbc/JdbcClientHelper.java index 32b0b4829c..591e80bf76 100644 --- a/modules/org.restlet.ext.jdbc_3.0/src/org/restlet/ext/jdbc/JdbcClientHelper.java +++ b/modules/org.restlet.ext.jdbc_3.0/src/org/restlet/ext/jdbc/JdbcClientHelper.java @@ -55,7 +55,7 @@ import org.restlet.data.Status; import org.restlet.engine.ClientHelper; import org.restlet.engine.Engine; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; diff --git a/modules/org.restlet.ext.jdbc_3.0/src/org/restlet/ext/jdbc/RowSetRepresentation.java b/modules/org.restlet.ext.jdbc_3.0/src/org/restlet/ext/jdbc/RowSetRepresentation.java index 2453988bf1..e49b0e97cc 100644 --- a/modules/org.restlet.ext.jdbc_3.0/src/org/restlet/ext/jdbc/RowSetRepresentation.java +++ b/modules/org.restlet.ext.jdbc_3.0/src/org/restlet/ext/jdbc/RowSetRepresentation.java @@ -35,7 +35,7 @@ import javax.sql.rowset.WebRowSet; import org.restlet.data.MediaType; -import org.restlet.resource.OutputRepresentation; +import org.restlet.representation.OutputRepresentation; import com.sun.rowset.WebRowSetImpl; diff --git a/modules/org.restlet.ext.jibx_1.1/META-INF/MANIFEST.MF b/modules/org.restlet.ext.jibx_1.1/META-INF/MANIFEST.MF index 2b64df3421..c990199a2a 100644 --- a/modules/org.restlet.ext.jibx_1.1/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.jibx_1.1/META-INF/MANIFEST.MF @@ -8,6 +8,7 @@ Export-Package: org.restlet.ext.jibx;uses:="org.restlet.resource,javax.xml.names Import-Package: org.jibx.runtime, org.restlet, org.restlet.data, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.jibx_1.1/src/org/restlet/ext/jibx/JibxRepresentation.java b/modules/org.restlet.ext.jibx_1.1/src/org/restlet/ext/jibx/JibxRepresentation.java index 6213d1fab6..8e887b4357 100644 --- a/modules/org.restlet.ext.jibx_1.1/src/org/restlet/ext/jibx/JibxRepresentation.java +++ b/modules/org.restlet.ext.jibx_1.1/src/org/restlet/ext/jibx/JibxRepresentation.java @@ -42,8 +42,8 @@ import org.jibx.runtime.IUnmarshallingContext; import org.jibx.runtime.JiBXException; import org.restlet.data.MediaType; -import org.restlet.resource.Representation; -import org.restlet.resource.XmlRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.XmlRepresentation; import org.w3c.dom.Document; /** diff --git a/modules/org.restlet.ext.json_2.0/META-INF/MANIFEST.MF b/modules/org.restlet.ext.json_2.0/META-INF/MANIFEST.MF index f0930d4473..170c535fe7 100644 --- a/modules/org.restlet.ext.json_2.0/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.json_2.0/META-INF/MANIFEST.MF @@ -8,6 +8,7 @@ Export-Package: org.restlet.ext.json;uses:="org.restlet.resource,org.json" Import-Package: org.json, org.restlet, org.restlet.data, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.json_2.0/src/org/restlet/ext/json/JsonRepresentation.java b/modules/org.restlet.ext.json_2.0/src/org/restlet/ext/json/JsonRepresentation.java index 28dcd4c22c..ca69bb649d 100644 --- a/modules/org.restlet.ext.json_2.0/src/org/restlet/ext/json/JsonRepresentation.java +++ b/modules/org.restlet.ext.json_2.0/src/org/restlet/ext/json/JsonRepresentation.java @@ -37,8 +37,8 @@ import org.json.JSONTokener; import org.restlet.data.CharacterSet; import org.restlet.data.MediaType; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; /** * Representation based on a JSON document. JSON stands for JavaScript Object diff --git a/modules/org.restlet.ext.jxta_2.5/META-INF/MANIFEST.MF b/modules/org.restlet.ext.jxta_2.5/META-INF/MANIFEST.MF index 4f00970a87..28713e9da3 100644 --- a/modules/org.restlet.ext.jxta_2.5/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.jxta_2.5/META-INF/MANIFEST.MF @@ -28,6 +28,7 @@ Import-Package: net.jxta, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.lucene_2.4/META-INF/MANIFEST.MF b/modules/org.restlet.ext.lucene_2.4/META-INF/MANIFEST.MF index 0686e2610c..05cf5196a2 100644 --- a/modules/org.restlet.ext.lucene_2.4/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.lucene_2.4/META-INF/MANIFEST.MF @@ -60,6 +60,7 @@ Import-Package: org.apache.commons.io, org.restlet.data, org.restlet.engine, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/SolrRepresentation.java b/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/SolrRepresentation.java index 9f7a1fea3b..6fcc5f1e3e 100644 --- a/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/SolrRepresentation.java +++ b/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/SolrRepresentation.java @@ -38,7 +38,7 @@ import org.apache.solr.request.XMLResponseWriter; import org.restlet.data.CharacterSet; import org.restlet.data.MediaType; -import org.restlet.resource.OutputRepresentation; +import org.restlet.representation.OutputRepresentation; /** * Representation wrapping a Solr query and exposing its response either as XML diff --git a/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/SolrRepresentationContentStream.java b/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/SolrRepresentationContentStream.java index 110e44022c..7084e68b8c 100644 --- a/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/SolrRepresentationContentStream.java +++ b/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/SolrRepresentationContentStream.java @@ -32,7 +32,7 @@ import java.io.Reader; import org.apache.solr.common.util.ContentStream; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Solr content stream wrapping a Restlet representation. diff --git a/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/TikaRepresentation.java b/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/TikaRepresentation.java index 59ac21db66..f21fe63704 100644 --- a/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/TikaRepresentation.java +++ b/modules/org.restlet.ext.lucene_2.4/src/org/restlet/ext/lucene/TikaRepresentation.java @@ -37,8 +37,8 @@ import org.apache.tika.parser.AutoDetectParser; import org.apache.tika.parser.Parser; import org.restlet.engine.util.DateUtils; -import org.restlet.resource.Representation; -import org.restlet.resource.SaxRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.SaxRepresentation; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; diff --git a/modules/org.restlet.ext.net/META-INF/MANIFEST.MF b/modules/org.restlet.ext.net/META-INF/MANIFEST.MF index 3ab39128b7..59784b0cff 100644 --- a/modules/org.restlet.ext.net/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.net/META-INF/MANIFEST.MF @@ -20,6 +20,7 @@ Import-Package: org.restlet, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.net/src/org/restlet/ext/net/HttpUrlConnectionCall.java b/modules/org.restlet.ext.net/src/org/restlet/ext/net/HttpUrlConnectionCall.java index 1796d40be2..e0e4347f14 100644 --- a/modules/org.restlet.ext.net/src/org/restlet/ext/net/HttpUrlConnectionCall.java +++ b/modules/org.restlet.ext.net/src/org/restlet/ext/net/HttpUrlConnectionCall.java @@ -47,7 +47,7 @@ import org.restlet.data.Status; import org.restlet.engine.http.HttpClientCall; import org.restlet.engine.util.SystemUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Series; import org.restlet.util.WrapperRepresentation; diff --git a/modules/org.restlet.ext.oauth_1.0/META-INF/MANIFEST.MF b/modules/org.restlet.ext.oauth_1.0/META-INF/MANIFEST.MF index e11cefe740..86b7b10b01 100644 --- a/modules/org.restlet.ext.oauth_1.0/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.oauth_1.0/META-INF/MANIFEST.MF @@ -28,6 +28,7 @@ Import-Package: net.oauth, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/AccessTokenResource.java b/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/AccessTokenResource.java index b37a8dd2d4..d3555225bc 100644 --- a/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/AccessTokenResource.java +++ b/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/AccessTokenResource.java @@ -40,11 +40,11 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * An OAuth Access Token. diff --git a/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/AuthorizationResource.java b/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/AuthorizationResource.java index bf38d8c210..bed274f624 100644 --- a/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/AuthorizationResource.java +++ b/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/AuthorizationResource.java @@ -37,9 +37,9 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.Variant; /** * Handles user authorization of an OAuth request token. diff --git a/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/RequestTokenResource.java b/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/RequestTokenResource.java index d9297c4c49..6cc7afd65a 100644 --- a/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/RequestTokenResource.java +++ b/modules/org.restlet.ext.oauth_1.0/src/org/restlet/ext/oauth/RequestTokenResource.java @@ -42,11 +42,11 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Get a OAuth request token. diff --git a/modules/org.restlet.ext.servlet_2.5/META-INF/MANIFEST.MF b/modules/org.restlet.ext.servlet_2.5/META-INF/MANIFEST.MF index 9ed3337f7e..e4eeb558d3 100644 --- a/modules/org.restlet.ext.servlet_2.5/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.servlet_2.5/META-INF/MANIFEST.MF @@ -24,6 +24,7 @@ Import-Package: javax.servlet, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.servlet_2.5/src/org/restlet/ext/servlet/ServerServlet.java b/modules/org.restlet.ext.servlet_2.5/src/org/restlet/ext/servlet/ServerServlet.java index b057f9e3b8..218562d039 100644 --- a/modules/org.restlet.ext.servlet_2.5/src/org/restlet/ext/servlet/ServerServlet.java +++ b/modules/org.restlet.ext.servlet_2.5/src/org/restlet/ext/servlet/ServerServlet.java @@ -54,7 +54,7 @@ /** * Servlet acting like an HTTP server connector. See <a - * href="/documentation/1.1/faq#02">Developper FAQ #2</a> for details on how to + * href="/documentation/1.1/faq#02">Developer FAQ #2</a> for details on how to * integrate a Restlet application into a servlet container.<br> * <br> * Initially designed to deploy a single Restlet Application, this Servlet can @@ -93,7 +93,7 @@ * </tr> * </table> * <br> - * In deployment mode 3, you can also add an optionnal "org.restlet.clients" + * In deployment mode 3, you can also add an optional "org.restlet.clients" * context parameter that contains a space separated list of client protocols * supported by the underlying component. For each one, a new client connector * is added to the Component instance.<br> @@ -149,19 +149,19 @@ * you can pass additional initialization parameters to your application, and * maybe share them with other Servlets.<br> * <br> - * An additionnal boolean parameter called "org.restlet.autoWire" allows you to + * An additional boolean parameter called "org.restlet.autoWire" allows you to * control the way your customized Component fits in the context of the wrapping * Servlet. The root cause is that both your Servlet Container and your Restlet * Component handle part of the URI routing, respectively to the right Servlet * and to the right virtual host and Restlets (most of the time Application * instances).<br> * <br> - * When a request reaches the Servlet container, it is first routed acccording - * to its web.xml configuration (i.e. declared virtual hosts and webapp context - * path which is generally the name of the webapp war file). Once the incoming + * When a request reaches the Servlet container, it is first routed according to + * its web.xml configuration (i.e. declared virtual hosts and webapp context + * path which is generally the name of the webapp WAR file). Once the incoming * request reaches the ServerServlet and the wrapped Restlet Component, its URI * is, for the second time, entirely subject to a separate routing chain. It - * begins with the virtual hosts, then continue to the URI pattern used when + * begins with the virtual hosts, then continues to the URI pattern used when * attaching Restlets to the host. The important conclusion is that both routing * configurations must be consistent in order to work fine.<br> * <br> diff --git a/modules/org.restlet.ext.servlet_2.5/src/org/restlet/ext/servlet/ServletWarEntity.java b/modules/org.restlet.ext.servlet_2.5/src/org/restlet/ext/servlet/ServletWarEntity.java index 2a04cf999e..e1171d6d76 100644 --- a/modules/org.restlet.ext.servlet_2.5/src/org/restlet/ext/servlet/ServletWarEntity.java +++ b/modules/org.restlet.ext.servlet_2.5/src/org/restlet/ext/servlet/ServletWarEntity.java @@ -39,8 +39,8 @@ import org.restlet.Context; import org.restlet.data.MediaType; import org.restlet.engine.local.Entity; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.Representation; /** * Local entity based on a Servlet context's resource file. diff --git a/modules/org.restlet.ext.shell/META-INF/MANIFEST.MF b/modules/org.restlet.ext.shell/META-INF/MANIFEST.MF index e1edae6ef7..f377ab44bf 100644 --- a/modules/org.restlet.ext.shell/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.shell/META-INF/MANIFEST.MF @@ -13,6 +13,7 @@ Import-Package: javax.script, org.apache.commons.cli, org.restlet, org.restlet.data, + org.restlet.representation, org.restlet.resource, org.restlet.util Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/modules/org.restlet.ext.shell/src/org/restlet/ext/shell/helpers/RepresentationHelper.java b/modules/org.restlet.ext.shell/src/org/restlet/ext/shell/helpers/RepresentationHelper.java index 0021d86bed..117e380df4 100644 --- a/modules/org.restlet.ext.shell/src/org/restlet/ext/shell/helpers/RepresentationHelper.java +++ b/modules/org.restlet.ext.shell/src/org/restlet/ext/shell/helpers/RepresentationHelper.java @@ -35,7 +35,7 @@ import java.io.OutputStream; import java.io.StringWriter; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * diff --git a/modules/org.restlet.ext.spring_2.5/META-INF/MANIFEST.MF b/modules/org.restlet.ext.spring_2.5/META-INF/MANIFEST.MF index d3b9c11c3c..07de5dc36c 100644 --- a/modules/org.restlet.ext.spring_2.5/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.spring_2.5/META-INF/MANIFEST.MF @@ -29,6 +29,7 @@ Import-Package: javax.servlet, org.restlet.engine, org.restlet.engine.component, org.restlet.ext.servlet, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util, diff --git a/modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringContext.java b/modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringContext.java index 8cdffc0beb..2bcab68b61 100644 --- a/modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringContext.java +++ b/modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringContext.java @@ -31,7 +31,7 @@ import java.util.List; import org.restlet.Context; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.support.GenericApplicationContext; diff --git a/modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringResource.java b/modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringResource.java index 42372a9945..4f99c40adc 100644 --- a/modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringResource.java +++ b/modules/org.restlet.ext.spring_2.5/src/org/restlet/ext/spring/SpringResource.java @@ -30,7 +30,7 @@ import java.io.IOException; import java.io.InputStream; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.springframework.core.io.AbstractResource; /** diff --git a/modules/org.restlet.ext.velocity_1.5/META-INF/MANIFEST.MF b/modules/org.restlet.ext.velocity_1.5/META-INF/MANIFEST.MF index ada9b09589..736e4808d9 100644 --- a/modules/org.restlet.ext.velocity_1.5/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.velocity_1.5/META-INF/MANIFEST.MF @@ -35,6 +35,7 @@ Import-Package: org.apache.commons.collections, org.apache.velocity.runtime.resource.loader, org.restlet, org.restlet.data, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/RepresentationResourceLoader.java b/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/RepresentationResourceLoader.java index aef6ec8761..153aa11ef8 100644 --- a/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/RepresentationResourceLoader.java +++ b/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/RepresentationResourceLoader.java @@ -36,7 +36,7 @@ import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.runtime.resource.Resource; import org.apache.velocity.runtime.resource.loader.ResourceLoader; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Velocity resource loader based on a static map of representations or on a diff --git a/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/TemplateFilter.java b/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/TemplateFilter.java index ad0a2b0aff..fed43b2af8 100644 --- a/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/TemplateFilter.java +++ b/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/TemplateFilter.java @@ -43,9 +43,8 @@ /** * Filter response's entity and wrap it with a Velocity's template - * representation.<br> - * By default, the template representation provides a data model based on the - * request and response objects.<br> + * representation. By default, the template representation provides a data model + * based on the request and response objects.<br> * * Concurrency note: instances of this class or its subclasses can be invoked by * several threads at the same time and therefore must be thread-safe. You diff --git a/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/TemplateRepresentation.java b/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/TemplateRepresentation.java index c9667a6e09..98e0b45e62 100644 --- a/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/TemplateRepresentation.java +++ b/modules/org.restlet.ext.velocity_1.5/src/org/restlet/ext/velocity/TemplateRepresentation.java @@ -48,8 +48,8 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.OutputRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.OutputRepresentation; +import org.restlet.representation.Representation; import org.restlet.util.Resolver; /** diff --git a/modules/org.restlet.ext.wadl_1.0/META-INF/MANIFEST.MF b/modules/org.restlet.ext.wadl_1.0/META-INF/MANIFEST.MF index 0a4cdbaac4..e74e5937c0 100644 --- a/modules/org.restlet.ext.wadl_1.0/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.wadl_1.0/META-INF/MANIFEST.MF @@ -8,6 +8,7 @@ Export-Package: org.restlet.ext.wadl;uses:="org.restlet,org.restlet.resource,org Import-Package: org.restlet, org.restlet.data, org.restlet.engine, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/DocumentationInfo.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/DocumentationInfo.java index 497eab9698..9136ff8489 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/DocumentationInfo.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/DocumentationInfo.java @@ -35,7 +35,7 @@ import org.restlet.Context; import org.restlet.data.Language; import org.restlet.data.MediaType; -import org.restlet.resource.DomRepresentation; +import org.restlet.representation.DomRepresentation; import org.restlet.util.XmlWriter; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java index 92c672b1c2..f752d425ef 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java @@ -36,7 +36,7 @@ import org.restlet.data.Method; import org.restlet.data.Reference; import org.restlet.data.Status; -import org.restlet.resource.Variant; +import org.restlet.representation.Variant; import org.restlet.util.XmlWriter; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java index 406ffc0b4c..b66e7f77c3 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java @@ -37,7 +37,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Reference; import org.restlet.data.Status; -import org.restlet.resource.Variant; +import org.restlet.representation.Variant; import org.restlet.util.XmlWriter; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlApplication.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlApplication.java index c0eacd7f64..deaa3ca796 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlApplication.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlApplication.java @@ -55,9 +55,9 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.engine.Engine; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.Variant; /** * WADL configured application. Can automatically configure itself given a WADL diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlComponent.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlComponent.java index cb271fc8b0..c40f432081 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlComponent.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlComponent.java @@ -30,7 +30,7 @@ import org.restlet.Component; import org.restlet.data.Reference; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Component that can automatically configure itself given a list of WADL diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlRepresentation.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlRepresentation.java index ec7cf0372d..684c661619 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlRepresentation.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlRepresentation.java @@ -44,11 +44,11 @@ import org.restlet.data.Reference; import org.restlet.data.Status; import org.restlet.engine.Engine; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.Representation; -import org.restlet.resource.SaxRepresentation; -import org.restlet.resource.TransformRepresentation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.SaxRepresentation; +import org.restlet.representation.TransformRepresentation; import org.restlet.util.XmlWriter; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java index 223f477147..be5d249bff 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java @@ -40,9 +40,9 @@ import org.restlet.data.Reference; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.Variant; /** * Resource that is able to automatically describe itself with WADL. This diff --git a/modules/org.restlet.ext.xdb_11.1/META-INF/MANIFEST.MF b/modules/org.restlet.ext.xdb_11.1/META-INF/MANIFEST.MF index 76d1151142..5e8f5eed8b 100644 --- a/modules/org.restlet.ext.xdb_11.1/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.xdb_11.1/META-INF/MANIFEST.MF @@ -30,6 +30,7 @@ Import-Package: javax.servlet, org.restlet.engine.security, org.restlet.engine.util, org.restlet.ext.servlet, + org.restlet.representation, org.restlet.resource, org.restlet.service, org.restlet.util diff --git a/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/XdbServerServlet.java b/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/XdbServerServlet.java index 1e8d3e69f9..f234c91539 100644 --- a/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/XdbServerServlet.java +++ b/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/XdbServerServlet.java @@ -59,8 +59,8 @@ /** * Servlet acting like an HTTP server connector. See <a - * href="/documentation/1.0/faq#02">Developper FAQ #2</a> for details on how to - * integrate a Restlet application into a servlet container.<br/> Here is a + * href="/documentation/1.1/faq#02">Developper FAQ #2</a> for details on how to + * integrate a Restlet application into a Servlet container.<br/> Here is a * sample configuration for your Restlet webapp: * * <pre> @@ -232,7 +232,7 @@ protected HttpServerHelper createServer(HttpServletRequest request) { result = new HttpServerHelper(server); // Attach the application, do not use getServletContext here because - // XMLDB allways return null + // XMLDB always return null final String uriPattern = request.getServletPath(); log("[Noelios Restlet Engine] - Attaching application: " + application + " to URI: " + uriPattern); diff --git a/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/XdbServletWarClientHelper.java b/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/XdbServletWarClientHelper.java index c8b6b4a3ec..5a05d531ba 100644 --- a/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/XdbServletWarClientHelper.java +++ b/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/XdbServletWarClientHelper.java @@ -47,8 +47,8 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.ext.servlet.ServletWarClientHelper; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.Representation; import org.restlet.service.MetadataService; diff --git a/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/package.html b/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/package.html index 365756c6b7..d94fafdd09 100644 --- a/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/package.html +++ b/modules/org.restlet.ext.xdb_11.1/src/org/restlet/ext/xdb/package.html @@ -5,6 +5,6 @@ @since Restlet 1.1 @see <a href="http://www.oracle.com/technology/tech/xml/xmldb/index.html">Oracle XML DB</a> -@see <a href="http://www.oracle.com/technology/tech/xml/xmldb/index.html">OracleJVM and Java Stored Procedures</a> +@see <a href="http://www.oracle.com/technology/tech/java/jsp/index.html">OracleJVM and Java Stored Procedures</a> </BODY> </HTML> \ No newline at end of file diff --git a/modules/org.restlet.test/META-INF/MANIFEST.MF b/modules/org.restlet.test/META-INF/MANIFEST.MF index 90afab037c..dda7c7fb45 100644 --- a/modules/org.restlet.test/META-INF/MANIFEST.MF +++ b/modules/org.restlet.test/META-INF/MANIFEST.MF @@ -69,6 +69,7 @@ Import-Package: com.google.gwt.core.client, org.restlet.gwt.data, org.restlet.gwt.resource, org.restlet.gwt.util, + org.restlet.representation, org.restlet.resource, org.restlet.security, org.restlet.service, diff --git a/modules/org.restlet.test/src/org/restlet/test/ComponentXmlConfigTestCase.java b/modules/org.restlet.test/src/org/restlet/test/ComponentXmlConfigTestCase.java index 18d1fe8ccf..da211dd3ab 100644 --- a/modules/org.restlet.test/src/org/restlet/test/ComponentXmlConfigTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/ComponentXmlConfigTestCase.java @@ -36,8 +36,8 @@ import org.restlet.Server; import org.restlet.VirtualHost; import org.restlet.data.Parameter; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.util.ClientList; import org.restlet.util.ServerList; diff --git a/modules/org.restlet.test/src/org/restlet/test/ComponentXmlTestCase.java b/modules/org.restlet.test/src/org/restlet/test/ComponentXmlTestCase.java index 4e3be6541d..20c566b357 100644 --- a/modules/org.restlet.test/src/org/restlet/test/ComponentXmlTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/ComponentXmlTestCase.java @@ -31,7 +31,7 @@ import org.restlet.Component; import org.restlet.data.Protocol; import org.restlet.data.Response; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; /** * Unit test case for the configuration of a component with an XML file. diff --git a/modules/org.restlet.test/src/org/restlet/test/DigestTestCase.java b/modules/org.restlet.test/src/org/restlet/test/DigestTestCase.java index f8cd936fb8..de90953906 100644 --- a/modules/org.restlet.test/src/org/restlet/test/DigestTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/DigestTestCase.java @@ -41,8 +41,8 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; /** * Test {@link org.restlet.engine.util.DateUtils}. diff --git a/modules/org.restlet.test/src/org/restlet/test/DirectoryTestCase.java b/modules/org.restlet.test/src/org/restlet/test/DirectoryTestCase.java index 5489d056ab..e8335cb6d4 100644 --- a/modules/org.restlet.test/src/org/restlet/test/DirectoryTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/DirectoryTestCase.java @@ -41,8 +41,8 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; /** * Unit tests for the Directory class. diff --git a/modules/org.restlet.test/src/org/restlet/test/FileClientTestCase.java b/modules/org.restlet.test/src/org/restlet/test/FileClientTestCase.java index 71b3068a34..ac37b88bfb 100644 --- a/modules/org.restlet.test/src/org/restlet/test/FileClientTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/FileClientTestCase.java @@ -35,7 +35,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; /** * Unit test case for the File client connector. diff --git a/modules/org.restlet.test/src/org/restlet/test/HeaderTestCase.java b/modules/org.restlet.test/src/org/restlet/test/HeaderTestCase.java index cfc2483566..3bc37a609f 100644 --- a/modules/org.restlet.test/src/org/restlet/test/HeaderTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/HeaderTestCase.java @@ -38,7 +38,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; public class HeaderTestCase extends RestletTestCase { diff --git a/modules/org.restlet.test/src/org/restlet/test/RangeTestCase.java b/modules/org.restlet.test/src/org/restlet/test/RangeTestCase.java index bab4ccea15..dbb8fbc250 100644 --- a/modules/org.restlet.test/src/org/restlet/test/RangeTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/RangeTestCase.java @@ -48,7 +48,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; /** * Test {@link org.restlet.data.Range}. diff --git a/modules/org.restlet.test/src/org/restlet/test/RedirectTestCase.java b/modules/org.restlet.test/src/org/restlet/test/RedirectTestCase.java index 080b7eac16..de2f756e20 100644 --- a/modules/org.restlet.test/src/org/restlet/test/RedirectTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/RedirectTestCase.java @@ -36,7 +36,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; /** * Unit tests for the RedirectRestlet. diff --git a/modules/org.restlet.test/src/org/restlet/test/ResolvingTransformerTestCase.java b/modules/org.restlet.test/src/org/restlet/test/ResolvingTransformerTestCase.java index 133bfffd8c..bab7bfb759 100644 --- a/modules/org.restlet.test/src/org/restlet/test/ResolvingTransformerTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/ResolvingTransformerTestCase.java @@ -50,9 +50,9 @@ import org.restlet.data.Reference; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.TransformRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.TransformRepresentation; /** * ResolvingTransformerTestCase tests the resolving aspects of the diff --git a/modules/org.restlet.test/src/org/restlet/test/RestletXmlTestCase.java b/modules/org.restlet.test/src/org/restlet/test/RestletXmlTestCase.java index dbfbcf5700..fb2968c7a3 100644 --- a/modules/org.restlet.test/src/org/restlet/test/RestletXmlTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/RestletXmlTestCase.java @@ -45,10 +45,10 @@ import org.junit.Before; import org.restlet.data.MediaType; import org.restlet.engine.util.DefaultSaxHandler; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.xml.sax.SAXException; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/RiapTestCase.java b/modules/org.restlet.test/src/org/restlet/test/RiapTestCase.java index 0cc44d990d..89fba2a024 100644 --- a/modules/org.restlet.test/src/org/restlet/test/RiapTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/RiapTestCase.java @@ -39,9 +39,9 @@ import org.restlet.data.Reference; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.ObjectRepresentation; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.ObjectRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; /** * Unit test case for the RIAP Internal routing protocol. diff --git a/modules/org.restlet.test/src/org/restlet/test/TransformerTestCase.java b/modules/org.restlet.test/src/org/restlet/test/TransformerTestCase.java index 49a9d1179d..2763d218c9 100644 --- a/modules/org.restlet.test/src/org/restlet/test/TransformerTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/TransformerTestCase.java @@ -34,9 +34,9 @@ import org.restlet.Component; import org.restlet.Transformer; import org.restlet.data.MediaType; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.TransformRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.TransformRepresentation; /** * Test case for the Transformer class. diff --git a/modules/org.restlet.test/src/org/restlet/test/bench/TestGetChunkedServer.java b/modules/org.restlet.test/src/org/restlet/test/bench/TestGetChunkedServer.java index 02d316af67..45effc1470 100644 --- a/modules/org.restlet.test/src/org/restlet/test/bench/TestGetChunkedServer.java +++ b/modules/org.restlet.test/src/org/restlet/test/bench/TestGetChunkedServer.java @@ -35,8 +35,8 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.FileRepresentation; -import org.restlet.resource.InputRepresentation; +import org.restlet.representation.FileRepresentation; +import org.restlet.representation.InputRepresentation; public class TestGetChunkedServer { diff --git a/modules/org.restlet.test/src/org/restlet/test/bench/TestGetServer.java b/modules/org.restlet.test/src/org/restlet/test/bench/TestGetServer.java index 3957b60c27..c2550d3f88 100644 --- a/modules/org.restlet.test/src/org/restlet/test/bench/TestGetServer.java +++ b/modules/org.restlet.test/src/org/restlet/test/bench/TestGetServer.java @@ -33,7 +33,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.FileRepresentation; +import org.restlet.representation.FileRepresentation; public class TestGetServer { diff --git a/modules/org.restlet.test/src/org/restlet/test/bench/TestPostChunkedClient.java b/modules/org.restlet.test/src/org/restlet/test/bench/TestPostChunkedClient.java index d9f2369163..db64952123 100644 --- a/modules/org.restlet.test/src/org/restlet/test/bench/TestPostChunkedClient.java +++ b/modules/org.restlet.test/src/org/restlet/test/bench/TestPostChunkedClient.java @@ -33,8 +33,8 @@ import org.restlet.data.MediaType; import org.restlet.data.Protocol; import org.restlet.data.Response; -import org.restlet.resource.FileRepresentation; -import org.restlet.resource.InputRepresentation; +import org.restlet.representation.FileRepresentation; +import org.restlet.representation.InputRepresentation; public class TestPostChunkedClient { diff --git a/modules/org.restlet.test/src/org/restlet/test/bench/TestPostClient.java b/modules/org.restlet.test/src/org/restlet/test/bench/TestPostClient.java index 386dd4cc71..d8b6d0c41c 100644 --- a/modules/org.restlet.test/src/org/restlet/test/bench/TestPostClient.java +++ b/modules/org.restlet.test/src/org/restlet/test/bench/TestPostClient.java @@ -31,7 +31,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Protocol; import org.restlet.data.Response; -import org.restlet.resource.FileRepresentation; +import org.restlet.representation.FileRepresentation; public class TestPostClient { diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/ChunkedEncodingPutTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/ChunkedEncodingPutTestCase.java index 9f3a2dfd07..4f859e78e4 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/ChunkedEncodingPutTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/ChunkedEncodingPutTestCase.java @@ -38,10 +38,10 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * This tests the ability of the connectors to handle chunked encoding. diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/ChunkedEncodingTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/ChunkedEncodingTestCase.java index efc64222cc..e6a0a741d7 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/ChunkedEncodingTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/ChunkedEncodingTestCase.java @@ -48,10 +48,10 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.engine.http.HttpConstants; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.Variant; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/GetChunkedTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/GetChunkedTestCase.java index 2cb30d6ec9..cb963a69b3 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/GetChunkedTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/GetChunkedTestCase.java @@ -39,11 +39,11 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.TransformRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.TransformRepresentation; -import org.restlet.resource.Variant; /** * Test that a simple get works for all the connectors. diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/GetTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/GetTestCase.java index 7875c5a170..5c76aa7929 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/GetTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/GetTestCase.java @@ -39,10 +39,10 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Test that a simple get works for all the connectors. diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/JavaMailTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/JavaMailTestCase.java index 303f3b0646..049e086f74 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/JavaMailTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/JavaMailTestCase.java @@ -39,7 +39,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.DomRepresentation; +import org.restlet.representation.DomRepresentation; import org.restlet.test.RestletTestCase; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/RemoteClientAddressTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/RemoteClientAddressTestCase.java index 9743c31692..97daec0add 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/RemoteClientAddressTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/RemoteClientAddressTestCase.java @@ -40,10 +40,10 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Test that the client address is available for all the connectors diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/SslGetTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/SslGetTestCase.java index 6875bccfdb..de100140ba 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/SslGetTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/SslGetTestCase.java @@ -39,10 +39,10 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Test that a simple get using SSL works for all the connectors. diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/UserAgentTestResource.java b/modules/org.restlet.test/src/org/restlet/test/engine/UserAgentTestResource.java index 175c846d54..f2e78b3df3 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/UserAgentTestResource.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/UserAgentTestResource.java @@ -31,11 +31,11 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.StringRepresentation; -import org.restlet.resource.Variant; /** * Simple resource that returns at least text/html and text/xml representations. diff --git a/modules/org.restlet.test/src/org/restlet/test/ext/atom/AtomTestCase.java b/modules/org.restlet.test/src/org/restlet/test/ext/atom/AtomTestCase.java index e5e075763c..e47b3a179d 100644 --- a/modules/org.restlet.test/src/org/restlet/test/ext/atom/AtomTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/ext/atom/AtomTestCase.java @@ -34,7 +34,7 @@ import org.restlet.data.MediaType; import org.restlet.ext.atom.Feed; import org.restlet.ext.atom.Service; -import org.restlet.resource.FileRepresentation; +import org.restlet.representation.FileRepresentation; import org.restlet.test.RestletTestCase; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/ext/lucene/LuceneTestCase.java b/modules/org.restlet.test/src/org/restlet/test/ext/lucene/LuceneTestCase.java index f8693412d5..6821ac09c2 100644 --- a/modules/org.restlet.test/src/org/restlet/test/ext/lucene/LuceneTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/ext/lucene/LuceneTestCase.java @@ -35,7 +35,7 @@ import org.apache.tika.parser.rtf.RTFParser; import org.restlet.Client; import org.restlet.ext.lucene.TikaRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.RestletTestCase; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/ext/velocity/VelocityTestCase.java b/modules/org.restlet.test/src/org/restlet/test/ext/velocity/VelocityTestCase.java index d7cff292b4..53b8fca195 100644 --- a/modules/org.restlet.test/src/org/restlet/test/ext/velocity/VelocityTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/ext/velocity/VelocityTestCase.java @@ -38,7 +38,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Reference; import org.restlet.ext.velocity.TemplateRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.RestletTestCase; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/server/RestletServerTestCase.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/server/RestletServerTestCase.java index 56158e18d8..10250e263b 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/server/RestletServerTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/server/RestletServerTestCase.java @@ -60,7 +60,7 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.engine.io.ByteUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.WrapperRepresentation; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/resources/RepresentationTestService.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/resources/RepresentationTestService.java index ca531e3da0..ea2b15651d 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/resources/RepresentationTestService.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/resources/RepresentationTestService.java @@ -38,8 +38,8 @@ import org.restlet.engine.application.DecodeRepresentation; import org.restlet.ext.jaxb.JaxbRepresentation; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.test.jaxrs.services.others.Person; import org.restlet.test.jaxrs.services.tests.RepresentationTest; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/CarTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/CarTest.java index aaaa54c866..c7c3d03962 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/CarTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/CarTest.java @@ -35,7 +35,7 @@ import org.restlet.data.Method; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.car.CarListResource; import org.restlet.test.jaxrs.services.car.CarResource; import org.restlet.test.jaxrs.services.car.EngineResource; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/CookieParamTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/CookieParamTest.java index 1760b1a570..0748750517 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/CookieParamTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/CookieParamTest.java @@ -39,7 +39,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.resources.CookieParamTestService; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/FormTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/FormTest.java index c70b46d0ab..e1bd42f75b 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/FormTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/FormTest.java @@ -35,7 +35,7 @@ import org.restlet.data.Form; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.resources.FormTestResource; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/HeadOptionsTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/HeadOptionsTest.java index 72e70b9821..3669403ac4 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/HeadOptionsTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/HeadOptionsTest.java @@ -36,7 +36,7 @@ import org.restlet.data.Method; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.others.OPTIONS; import org.restlet.test.jaxrs.services.resources.HeadOptionsTestService; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/HttpHeaderTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/HttpHeaderTest.java index 3b385db172..e03bb5c7df 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/HttpHeaderTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/HttpHeaderTest.java @@ -44,7 +44,7 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.ext.jaxrs.internal.util.Util; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; import org.restlet.test.jaxrs.services.resources.HttpHeaderTestService; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/Issue593Test.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/Issue593Test.java index 13ce05f137..141faa05d1 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/Issue593Test.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/Issue593Test.java @@ -34,7 +34,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.resources.Issue593Resource; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/Issue594Test.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/Issue594Test.java index c560b22141..62213969cc 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/Issue594Test.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/Issue594Test.java @@ -34,7 +34,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.resources.Issue594Resources; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/JaxRsTestCase.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/JaxRsTestCase.java index 925c2d5cc7..bcb1f1ecc9 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/JaxRsTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/JaxRsTestCase.java @@ -61,7 +61,7 @@ import org.restlet.ext.jaxrs.internal.todo.NotYetImplementedException; import org.restlet.ext.jaxrs.internal.util.Converter; import org.restlet.ext.jaxrs.internal.util.Util; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.server.RestletServerTestCase; import org.restlet.test.jaxrs.util.OrderedReadonlySet; import org.restlet.test.jaxrs.util.TestUtils; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/JsonTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/JsonTest.java index 4da8f32123..71090f330d 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/JsonTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/JsonTest.java @@ -42,8 +42,8 @@ import org.restlet.ext.jaxb.JaxbRepresentation; import org.restlet.ext.jaxrs.JaxRsApplication; import org.restlet.ext.jaxrs.internal.provider.JsonProvider; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.test.jaxrs.services.others.Person; import org.restlet.test.jaxrs.services.resources.JsonTestService; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/MessageBodyWritersTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/MessageBodyWritersTest.java index 6743fd4564..ff5ba39d0e 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/MessageBodyWritersTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/MessageBodyWritersTest.java @@ -36,7 +36,7 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.ext.jaxrs.internal.todo.NotYetImplementedException; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.providers.TextCrazyPersonProvider; import org.restlet.test.jaxrs.services.providers.AppCrazyPersonProvider; import org.restlet.test.jaxrs.services.resources.MessageBodyWriterTestResource; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/PrimitiveWrapperEntityTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/PrimitiveWrapperEntityTest.java index 46aa9b2d5d..bd727b3093 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/PrimitiveWrapperEntityTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/PrimitiveWrapperEntityTest.java @@ -33,7 +33,7 @@ import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; import org.restlet.test.jaxrs.services.providers.BooleanEntityProvider; import org.restlet.test.jaxrs.services.providers.CharacterEntityProvider; import org.restlet.test.jaxrs.services.providers.IntegerEntityProvider; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/ProviderTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/ProviderTest.java index 75551fc7a0..756d46d46e 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/ProviderTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/ProviderTest.java @@ -46,9 +46,9 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.ext.jaxrs.internal.provider.JaxbElementProvider; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.test.jaxrs.services.others.Person; import org.restlet.test.jaxrs.services.resources.ProviderTestService; import org.w3c.dom.DOMException; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/RepresentationTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/RepresentationTest.java index c68d69fa8e..ee7c742426 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/RepresentationTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/RepresentationTest.java @@ -35,8 +35,8 @@ import org.restlet.data.MediaType; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.test.jaxrs.services.others.Person; import org.restlet.test.jaxrs.services.resources.RepresentationTestService; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SecurityContextTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SecurityContextTest.java index 49334a7226..520570f4fe 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SecurityContextTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SecurityContextTest.java @@ -41,7 +41,7 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.ext.jaxrs.RoleChecker; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.resources.SecurityContextService; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SimpleHouseTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SimpleHouseTest.java index 00ca62a200..e5347d7d00 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SimpleHouseTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SimpleHouseTest.java @@ -34,7 +34,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.resources.SimpleHouse; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SimpleTrainTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SimpleTrainTest.java index 84b2e66caf..47201f0f84 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SimpleTrainTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/SimpleTrainTest.java @@ -36,7 +36,7 @@ import org.restlet.data.Preference; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.resources.SimpleTrain; import org.restlet.test.jaxrs.util.TestUtils; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/ThrowWebAppExcProviderTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/ThrowWebAppExcProviderTest.java index 47b77c92c5..c594488395 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/ThrowWebAppExcProviderTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/ThrowWebAppExcProviderTest.java @@ -32,7 +32,7 @@ import javax.ws.rs.core.Application; import org.restlet.data.Response; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.StringRepresentation; import org.restlet.test.jaxrs.services.providers.ThrowWebAppExcProvider; import org.restlet.test.jaxrs.services.resources.SimpleResource; import org.restlet.test.jaxrs.util.TestUtils; diff --git a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/UriBuilderByServiceTest.java b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/UriBuilderByServiceTest.java index bcbf008722..8874d1b430 100644 --- a/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/UriBuilderByServiceTest.java +++ b/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/UriBuilderByServiceTest.java @@ -37,7 +37,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.test.jaxrs.services.resources.UriBuilderTestResource; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/resource/FileRepresentationTestCase.java b/modules/org.restlet.test/src/org/restlet/test/resource/FileRepresentationTestCase.java index d921c61cf7..82ebb6d5d4 100644 --- a/modules/org.restlet.test/src/org/restlet/test/resource/FileRepresentationTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/resource/FileRepresentationTestCase.java @@ -41,8 +41,8 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.FileRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.FileRepresentation; +import org.restlet.representation.Representation; import org.restlet.test.RestletTestCase; /** diff --git a/modules/org.restlet.test/src/org/restlet/test/resource/ResourceTestCase.java b/modules/org.restlet.test/src/org/restlet/test/resource/ResourceTestCase.java index 17862f4cfa..b865aa8d7c 100644 --- a/modules/org.restlet.test/src/org/restlet/test/resource/ResourceTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/resource/ResourceTestCase.java @@ -28,9 +28,9 @@ package org.restlet.test.resource; import org.restlet.data.MediaType; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.resource.Resource; -import org.restlet.resource.StringRepresentation; import org.restlet.test.RestletTestCase; /** diff --git a/modules/org.restlet/META-INF/MANIFEST.MF b/modules/org.restlet/META-INF/MANIFEST.MF index 5f202c967c..b711f42c80 100644 --- a/modules/org.restlet/META-INF/MANIFEST.MF +++ b/modules/org.restlet/META-INF/MANIFEST.MF @@ -10,11 +10,13 @@ Export-Package: org.restlet, org.restlet.engine, org.restlet.engine.application, org.restlet.engine.component, + org.restlet.engine.converter, org.restlet.engine.http, org.restlet.engine.io, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, + org.restlet.representation, org.restlet.resource, org.restlet.security, org.restlet.service, diff --git a/modules/org.restlet/src/org/restlet/Component.java b/modules/org.restlet/src/org/restlet/Component.java index ca2fc5be34..69a1b0fc3e 100644 --- a/modules/org.restlet/src/org/restlet/Component.java +++ b/modules/org.restlet/src/org/restlet/Component.java @@ -44,9 +44,9 @@ import org.restlet.engine.Helper; import org.restlet.engine.component.ComponentHelper; import org.restlet.engine.util.DefaultSaxHandler; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.FileRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.FileRepresentation; +import org.restlet.representation.Representation; import org.restlet.resource.Resource; import org.restlet.security.Organization; import org.restlet.service.LogService; diff --git a/modules/org.restlet/src/org/restlet/Directory.java b/modules/org.restlet/src/org/restlet/Directory.java index 9866e219ac..2b0ca78f50 100644 --- a/modules/org.restlet/src/org/restlet/Directory.java +++ b/modules/org.restlet/src/org/restlet/Directory.java @@ -38,8 +38,8 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.engine.local.DirectoryResource; -import org.restlet.resource.Representation; -import org.restlet.resource.Variant; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; /** * Finder mapping a directory of local resources. Those resources have diff --git a/modules/org.restlet/src/org/restlet/Redirector.java b/modules/org.restlet/src/org/restlet/Redirector.java index afb219d6a6..e4e0300071 100644 --- a/modules/org.restlet/src/org/restlet/Redirector.java +++ b/modules/org.restlet/src/org/restlet/Redirector.java @@ -33,7 +33,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Template; /** diff --git a/modules/org.restlet/src/org/restlet/Route.java b/modules/org.restlet/src/org/restlet/Route.java index 019ef150c9..583a4bad04 100644 --- a/modules/org.restlet/src/org/restlet/Route.java +++ b/modules/org.restlet/src/org/restlet/Route.java @@ -34,10 +34,12 @@ import org.restlet.data.Cookie; import org.restlet.data.Form; +import org.restlet.data.Message; import org.restlet.data.Reference; import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; +import org.restlet.resource.ServerResource; import org.restlet.util.Series; import org.restlet.util.Template; import org.restlet.util.Variable; @@ -332,7 +334,9 @@ private void extractAttributes(Request request, Response response) { * Indicates if only the first cookie should be set. Otherwise as * a List instance might be set in the attribute value. * @return The current Filter. + * @deprecated Use the {@link ServerResource#getCookies()} method instead. */ + @Deprecated public Route extractCookie(String attribute, String cookieName, boolean first) { getCookieExtracts().add(new ExtractInfo(attribute, cookieName, first)); @@ -350,7 +354,9 @@ public Route extractCookie(String attribute, String cookieName, * Indicates if only the first cookie should be set. Otherwise as * a List instance might be set in the attribute value. * @return The current Filter. + * @deprecated Use the {@link Message#getEntityAsForm()} method instead. */ + @Deprecated public Route extractEntity(String attribute, String parameter, boolean first) { getEntityExtracts().add(new ExtractInfo(attribute, parameter, first)); return this; @@ -367,7 +373,9 @@ public Route extractEntity(String attribute, String parameter, boolean first) { * Indicates if only the first cookie should be set. Otherwise as * a List instance might be set in the attribute value. * @return The current Filter. + * @deprecated Use the {@link ServerResource#getQuery()} method instead. */ + @Deprecated public Route extractQuery(String attribute, String parameter, boolean first) { getQueryExtracts().add(new ExtractInfo(attribute, parameter, first)); return this; diff --git a/modules/org.restlet/src/org/restlet/Transformer.java b/modules/org.restlet/src/org/restlet/Transformer.java index 825168f15c..6aa1d697de 100644 --- a/modules/org.restlet/src/org/restlet/Transformer.java +++ b/modules/org.restlet/src/org/restlet/Transformer.java @@ -36,12 +36,12 @@ import org.restlet.data.MediaType; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; -import org.restlet.resource.TransformRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.TransformRepresentation; /** * Filter that can transform XML representations by applying an XSLT transform - * sheet. It uses the {@link org.restlet.resource.TransformRepresentation} to + * sheet. It uses the {@link org.restlet.representation.TransformRepresentation} to * actually transform the XML entities.<br> * <br> * Concurrency note: instances of this class or its subclasses can be invoked by diff --git a/modules/org.restlet/src/org/restlet/Uniform.java b/modules/org.restlet/src/org/restlet/Uniform.java index 02556e04ab..f484211276 100644 --- a/modules/org.restlet/src/org/restlet/Uniform.java +++ b/modules/org.restlet/src/org/restlet/Uniform.java @@ -31,7 +31,7 @@ import org.restlet.data.Reference; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Base class exposing the uniform REST interface. "The central feature that diff --git a/modules/org.restlet/src/org/restlet/data/ClientInfo.java b/modules/org.restlet/src/org/restlet/data/ClientInfo.java index 63c1008a22..2bc53c6830 100644 --- a/modules/org.restlet/src/org/restlet/data/ClientInfo.java +++ b/modules/org.restlet/src/org/restlet/data/ClientInfo.java @@ -42,8 +42,8 @@ import org.restlet.engine.Engine; import org.restlet.engine.http.UserAgentUtils; import org.restlet.engine.util.ConnegUtils; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; -import org.restlet.resource.Variant; import org.restlet.security.Role; import org.restlet.security.RolePrincipal; import org.restlet.util.Template; diff --git a/modules/org.restlet/src/org/restlet/data/Conditions.java b/modules/org.restlet/src/org/restlet/data/Conditions.java index 73904d9390..84a55482cc 100644 --- a/modules/org.restlet/src/org/restlet/data/Conditions.java +++ b/modules/org.restlet/src/org/restlet/data/Conditions.java @@ -33,7 +33,7 @@ import java.util.List; import org.restlet.engine.util.DateUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Set of conditions applying to a request. This is equivalent to the HTTP diff --git a/modules/org.restlet/src/org/restlet/data/Form.java b/modules/org.restlet/src/org/restlet/data/Form.java index 67ff42bc30..e60546d7f2 100644 --- a/modules/org.restlet/src/org/restlet/data/Form.java +++ b/modules/org.restlet/src/org/restlet/data/Form.java @@ -31,8 +31,8 @@ import java.util.List; import org.restlet.engine.util.FormUtils; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.util.Series; /** diff --git a/modules/org.restlet/src/org/restlet/data/Graph.java b/modules/org.restlet/src/org/restlet/data/Graph.java index 2309b5f58c..a2c38e289d 100644 --- a/modules/org.restlet/src/org/restlet/data/Graph.java +++ b/modules/org.restlet/src/org/restlet/data/Graph.java @@ -29,7 +29,7 @@ import java.util.concurrent.CopyOnWriteArraySet; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Graph composed of links. This also called a set of RDF statements or a RDF diff --git a/modules/org.restlet/src/org/restlet/data/Message.java b/modules/org.restlet/src/org/restlet/data/Message.java index e95049cfa1..5aca7ea60b 100644 --- a/modules/org.restlet/src/org/restlet/data/Message.java +++ b/modules/org.restlet/src/org/restlet/data/Message.java @@ -33,10 +33,10 @@ import java.util.logging.Level; import org.restlet.Context; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; -import org.restlet.resource.SaxRepresentation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.SaxRepresentation; +import org.restlet.representation.StringRepresentation; /** * Generic message exchanged between client and server connectors. diff --git a/modules/org.restlet/src/org/restlet/data/ReferenceList.java b/modules/org.restlet/src/org/restlet/data/ReferenceList.java index 2cc93478bb..81222fe888 100644 --- a/modules/org.restlet/src/org/restlet/data/ReferenceList.java +++ b/modules/org.restlet/src/org/restlet/data/ReferenceList.java @@ -33,8 +33,8 @@ import java.util.ArrayList; import java.util.List; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.util.WrapperList; /** diff --git a/modules/org.restlet/src/org/restlet/data/Request.java b/modules/org.restlet/src/org/restlet/data/Request.java index 3305e8e532..d2d4b590c6 100644 --- a/modules/org.restlet/src/org/restlet/data/Request.java +++ b/modules/org.restlet/src/org/restlet/data/Request.java @@ -31,7 +31,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import org.restlet.Context; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.service.TunnelService; import org.restlet.util.Series; diff --git a/modules/org.restlet/src/org/restlet/engine/StatusFilter.java b/modules/org.restlet/src/org/restlet/engine/StatusFilter.java index c08b8136f3..754a48551f 100644 --- a/modules/org.restlet/src/org/restlet/engine/StatusFilter.java +++ b/modules/org.restlet/src/org/restlet/engine/StatusFilter.java @@ -36,8 +36,8 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; -import org.restlet.resource.StringRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.StringRepresentation; import org.restlet.service.StatusService; /** diff --git a/modules/org.restlet/src/org/restlet/engine/application/DecodeRepresentation.java b/modules/org.restlet/src/org/restlet/engine/application/DecodeRepresentation.java index 3862caa0f3..e9e369d2f4 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/DecodeRepresentation.java +++ b/modules/org.restlet/src/org/restlet/engine/application/DecodeRepresentation.java @@ -42,7 +42,7 @@ import org.restlet.data.Encoding; import org.restlet.engine.io.ByteUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.WrapperRepresentation; /** diff --git a/modules/org.restlet/src/org/restlet/engine/application/Decoder.java b/modules/org.restlet/src/org/restlet/engine/application/Decoder.java index 8d69854ef5..2ab1f566bc 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/Decoder.java +++ b/modules/org.restlet/src/org/restlet/engine/application/Decoder.java @@ -34,7 +34,7 @@ import org.restlet.data.Encoding; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Filter decompressing entities. diff --git a/modules/org.restlet/src/org/restlet/engine/application/EncodeRepresentation.java b/modules/org.restlet/src/org/restlet/engine/application/EncodeRepresentation.java index dce58876c5..5006d7c4d7 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/EncodeRepresentation.java +++ b/modules/org.restlet/src/org/restlet/engine/application/EncodeRepresentation.java @@ -43,7 +43,7 @@ import org.restlet.data.Encoding; import org.restlet.engine.io.ByteUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.WrapperList; import org.restlet.util.WrapperRepresentation; diff --git a/modules/org.restlet/src/org/restlet/engine/application/Encoder.java b/modules/org.restlet/src/org/restlet/engine/application/Encoder.java index e87688545f..35d7ac31f9 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/Encoder.java +++ b/modules/org.restlet/src/org/restlet/engine/application/Encoder.java @@ -40,13 +40,13 @@ import org.restlet.data.Preference; import org.restlet.data.Request; import org.restlet.data.Response; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Filter compressing entities. The best encoding is automatically selected * based on the preferences of the client and on the encoding supported by NRE: * GZip, Zip and Deflate.<br> - * If the {@link org.restlet.resource.Representation} has an unknown size, it + * If the {@link org.restlet.representation.Representation} has an unknown size, it * will always be a candidate for encoding. Candidate representations need to * respect media type criteria by the lists of accepted and ignored media types. * diff --git a/modules/org.restlet/src/org/restlet/engine/application/RangeFilter.java b/modules/org.restlet/src/org/restlet/engine/application/RangeFilter.java index 148398aa94..5169f85201 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/RangeFilter.java +++ b/modules/org.restlet/src/org/restlet/engine/application/RangeFilter.java @@ -34,7 +34,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.service.RangeService; /** diff --git a/modules/org.restlet/src/org/restlet/engine/application/RangeInputStream.java b/modules/org.restlet/src/org/restlet/engine/application/RangeInputStream.java index dedc8cb606..36761a878b 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/RangeInputStream.java +++ b/modules/org.restlet/src/org/restlet/engine/application/RangeInputStream.java @@ -32,7 +32,7 @@ import java.io.InputStream; import org.restlet.data.Range; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Filters an input stream to expose only a given range. diff --git a/modules/org.restlet/src/org/restlet/engine/application/RangeRepresentation.java b/modules/org.restlet/src/org/restlet/engine/application/RangeRepresentation.java index b88a827307..23cf0ab933 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/RangeRepresentation.java +++ b/modules/org.restlet/src/org/restlet/engine/application/RangeRepresentation.java @@ -34,7 +34,7 @@ import org.restlet.data.Range; import org.restlet.engine.io.ByteUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.WrapperRepresentation; /** diff --git a/modules/org.restlet/src/org/restlet/engine/application/TunnelFilter.java b/modules/org.restlet/src/org/restlet/engine/application/TunnelFilter.java index 3aeed7ac13..df1c4365d1 100644 --- a/modules/org.restlet/src/org/restlet/engine/application/TunnelFilter.java +++ b/modules/org.restlet/src/org/restlet/engine/application/TunnelFilter.java @@ -54,7 +54,7 @@ import org.restlet.service.TunnelService; /** - * Filter tunnelling browser calls into full REST calls. The request method can + * Filter tunneling browser calls into full REST calls. The request method can * be changed (via POST requests only) as well as the accepted media types, * languages, encodings and character sets. * diff --git a/modules/org.restlet/src/org/restlet/engine/converter/ConverterHelper.java b/modules/org.restlet/src/org/restlet/engine/converter/ConverterHelper.java index 5206702352..c81e0d5d6f 100644 --- a/modules/org.restlet/src/org/restlet/engine/converter/ConverterHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/converter/ConverterHelper.java @@ -29,9 +29,9 @@ import java.util.List; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.UniformResource; -import org.restlet.resource.Variant; /** * Converter between Representations and regular Java objects. diff --git a/modules/org.restlet/src/org/restlet/engine/converter/DomConverter.java b/modules/org.restlet/src/org/restlet/engine/converter/DomConverter.java index 7d76fbcfa4..f4b4f7670a 100644 --- a/modules/org.restlet/src/org/restlet/engine/converter/DomConverter.java +++ b/modules/org.restlet/src/org/restlet/engine/converter/DomConverter.java @@ -29,9 +29,9 @@ import java.util.List; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.UniformResource; -import org.restlet.resource.Variant; /** * Converter between the DOM API and Representation classes. diff --git a/modules/org.restlet/src/org/restlet/engine/http/HttpCall.java b/modules/org.restlet/src/org/restlet/engine/http/HttpCall.java index 2a81b5564e..71e1ad2525 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/HttpCall.java +++ b/modules/org.restlet/src/org/restlet/engine/http/HttpCall.java @@ -38,7 +38,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Request; import org.restlet.engine.util.DateUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.service.ConnectorService; import org.restlet.util.Series; diff --git a/modules/org.restlet/src/org/restlet/engine/http/HttpClientCall.java b/modules/org.restlet/src/org/restlet/engine/http/HttpClientCall.java index 9507e78b5f..6266ab7ba1 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/HttpClientCall.java +++ b/modules/org.restlet/src/org/restlet/engine/http/HttpClientCall.java @@ -46,9 +46,9 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.data.Tag; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.ReadableRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.ReadableRepresentation; +import org.restlet.representation.Representation; import org.restlet.service.ConnectorService; import org.restlet.util.Series; diff --git a/modules/org.restlet/src/org/restlet/engine/http/HttpRequest.java b/modules/org.restlet/src/org/restlet/engine/http/HttpRequest.java index 4be23ee9d4..7e0ba40d73 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/HttpRequest.java +++ b/modules/org.restlet/src/org/restlet/engine/http/HttpRequest.java @@ -45,7 +45,7 @@ import org.restlet.data.Tag; import org.restlet.engine.security.AuthenticatorUtils; import org.restlet.engine.util.RangeUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Series; /** diff --git a/modules/org.restlet/src/org/restlet/engine/http/HttpServerCall.java b/modules/org.restlet/src/org/restlet/engine/http/HttpServerCall.java index 974775a8e9..af27fc2251 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/HttpServerCall.java +++ b/modules/org.restlet/src/org/restlet/engine/http/HttpServerCall.java @@ -44,9 +44,9 @@ import org.restlet.data.Response; import org.restlet.engine.util.Base64; import org.restlet.engine.util.RangeUtils; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.ReadableRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.ReadableRepresentation; +import org.restlet.representation.Representation; import org.restlet.service.ConnectorService; /** diff --git a/modules/org.restlet/src/org/restlet/engine/http/HttpServerConverter.java b/modules/org.restlet/src/org/restlet/engine/http/HttpServerConverter.java index 2acdc03b2c..5c9d3387c0 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/HttpServerConverter.java +++ b/modules/org.restlet/src/org/restlet/engine/http/HttpServerConverter.java @@ -48,7 +48,7 @@ import org.restlet.engine.util.Base64; import org.restlet.engine.util.DateUtils; import org.restlet.engine.util.RangeUtils; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Series; /** diff --git a/modules/org.restlet/src/org/restlet/engine/http/StreamClientCall.java b/modules/org.restlet/src/org/restlet/engine/http/StreamClientCall.java index cac16f1244..8a92c67c60 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/StreamClientCall.java +++ b/modules/org.restlet/src/org/restlet/engine/http/StreamClientCall.java @@ -48,7 +48,7 @@ import org.restlet.data.Status; import org.restlet.engine.io.InputEntityStream; import org.restlet.engine.io.KeepAliveOutputStream; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.WrapperRepresentation; /** diff --git a/modules/org.restlet/src/org/restlet/engine/io/ByteUtils.java b/modules/org.restlet/src/org/restlet/engine/io/ByteUtils.java index 74cf42a0f8..7ad7aa3ae5 100644 --- a/modules/org.restlet/src/org/restlet/engine/io/ByteUtils.java +++ b/modules/org.restlet/src/org/restlet/engine/io/ByteUtils.java @@ -50,8 +50,8 @@ import org.restlet.Application; import org.restlet.Context; import org.restlet.data.CharacterSet; -import org.restlet.resource.Representation; -import org.restlet.resource.WriterRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.WriterRepresentation; import org.restlet.service.TaskService; /** diff --git a/modules/org.restlet/src/org/restlet/engine/local/ClapClientHelper.java b/modules/org.restlet/src/org/restlet/engine/local/ClapClientHelper.java index 09bcef82ba..0a995072d9 100644 --- a/modules/org.restlet/src/org/restlet/engine/local/ClapClientHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/local/ClapClientHelper.java @@ -41,8 +41,8 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.InputRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.InputRepresentation; +import org.restlet.representation.Representation; import org.restlet.service.MetadataService; /** diff --git a/modules/org.restlet/src/org/restlet/engine/local/DirectoryResource.java b/modules/org.restlet/src/org/restlet/engine/local/DirectoryResource.java index 6c3784a2ed..78adfc64a4 100644 --- a/modules/org.restlet/src/org/restlet/engine/local/DirectoryResource.java +++ b/modules/org.restlet/src/org/restlet/engine/local/DirectoryResource.java @@ -46,10 +46,10 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.Resource; import org.restlet.resource.ResourceException; -import org.restlet.resource.Variant; /** * Resource supported by a set of context representations (from file system, diff --git a/modules/org.restlet/src/org/restlet/engine/local/Entity.java b/modules/org.restlet/src/org/restlet/engine/local/Entity.java index f7c3263f8e..45f54628cc 100644 --- a/modules/org.restlet/src/org/restlet/engine/local/Entity.java +++ b/modules/org.restlet/src/org/restlet/engine/local/Entity.java @@ -34,7 +34,7 @@ import java.util.TreeSet; import org.restlet.data.MediaType; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.service.MetadataService; /** diff --git a/modules/org.restlet/src/org/restlet/engine/local/EntityClientHelper.java b/modules/org.restlet/src/org/restlet/engine/local/EntityClientHelper.java index e377ffe094..a0441829c7 100644 --- a/modules/org.restlet/src/org/restlet/engine/local/EntityClientHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/local/EntityClientHelper.java @@ -39,7 +39,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.service.MetadataService; /** diff --git a/modules/org.restlet/src/org/restlet/engine/local/FileClientHelper.java b/modules/org.restlet/src/org/restlet/engine/local/FileClientHelper.java index d1cad8f79c..875eb6d3f8 100644 --- a/modules/org.restlet/src/org/restlet/engine/local/FileClientHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/local/FileClientHelper.java @@ -53,8 +53,8 @@ import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.engine.io.ByteUtils; -import org.restlet.resource.Representation; -import org.restlet.resource.Variant; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.service.MetadataService; /** diff --git a/modules/org.restlet/src/org/restlet/engine/local/FileEntity.java b/modules/org.restlet/src/org/restlet/engine/local/FileEntity.java index bb2a77269c..f03b62b63c 100644 --- a/modules/org.restlet/src/org/restlet/engine/local/FileEntity.java +++ b/modules/org.restlet/src/org/restlet/engine/local/FileEntity.java @@ -32,8 +32,8 @@ import java.util.List; import org.restlet.data.MediaType; -import org.restlet.resource.FileRepresentation; -import org.restlet.resource.Representation; +import org.restlet.representation.FileRepresentation; +import org.restlet.representation.Representation; /** * Local entity based on a regular {@link File}. diff --git a/modules/org.restlet/src/org/restlet/engine/local/LocalClientHelper.java b/modules/org.restlet/src/org/restlet/engine/local/LocalClientHelper.java index 2abc4285cb..c91301f4de 100644 --- a/modules/org.restlet/src/org/restlet/engine/local/LocalClientHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/local/LocalClientHelper.java @@ -36,7 +36,7 @@ import org.restlet.data.Metadata; import org.restlet.data.Request; import org.restlet.engine.ClientHelper; -import org.restlet.resource.Variant; +import org.restlet.representation.Variant; import org.restlet.service.MetadataService; diff --git a/modules/org.restlet/src/org/restlet/engine/util/ConnegUtils.java b/modules/org.restlet/src/org/restlet/engine/util/ConnegUtils.java index fe5e4704d1..6c7c3c086f 100644 --- a/modules/org.restlet/src/org/restlet/engine/util/ConnegUtils.java +++ b/modules/org.restlet/src/org/restlet/engine/util/ConnegUtils.java @@ -36,7 +36,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Parameter; import org.restlet.data.Preference; -import org.restlet.resource.Variant; +import org.restlet.representation.Variant; /** * Content negotiation utilities. diff --git a/modules/org.restlet/src/org/restlet/engine/util/FormReader.java b/modules/org.restlet/src/org/restlet/engine/util/FormReader.java index 5757f0d221..9a6faba620 100644 --- a/modules/org.restlet/src/org/restlet/engine/util/FormReader.java +++ b/modules/org.restlet/src/org/restlet/engine/util/FormReader.java @@ -40,7 +40,7 @@ import org.restlet.data.CharacterSet; import org.restlet.data.Form; import org.restlet.data.Parameter; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; import org.restlet.util.Series; /** diff --git a/modules/org.restlet/src/org/restlet/engine/util/FormUtils.java b/modules/org.restlet/src/org/restlet/engine/util/FormUtils.java index a220fcbc35..8d6995b903 100644 --- a/modules/org.restlet/src/org/restlet/engine/util/FormUtils.java +++ b/modules/org.restlet/src/org/restlet/engine/util/FormUtils.java @@ -38,7 +38,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Parameter; import org.restlet.data.Reference; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Representation of a Web form containing submitted parameters. diff --git a/modules/org.restlet/src/org/restlet/engine/util/RangeUtils.java b/modules/org.restlet/src/org/restlet/engine/util/RangeUtils.java index 098150bbc0..78c9026aca 100644 --- a/modules/org.restlet/src/org/restlet/engine/util/RangeUtils.java +++ b/modules/org.restlet/src/org/restlet/engine/util/RangeUtils.java @@ -31,7 +31,7 @@ import java.util.List; import org.restlet.data.Range; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Range manipulation utilities. diff --git a/modules/org.restlet/src/org/restlet/resource/ChannelRepresentation.java b/modules/org.restlet/src/org/restlet/representation/ChannelRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/ChannelRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/ChannelRepresentation.java index 22a3be03e2..2e5e3fcf47 100644 --- a/modules/org.restlet/src/org/restlet/resource/ChannelRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/ChannelRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.InputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/CharacterRepresentation.java b/modules/org.restlet/src/org/restlet/representation/CharacterRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/CharacterRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/CharacterRepresentation.java index db2cff9968..8ef4506b0e 100644 --- a/modules/org.restlet/src/org/restlet/resource/CharacterRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/CharacterRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.InputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/DigestRepresentation.java b/modules/org.restlet/src/org/restlet/representation/DigestRepresentation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/DigestRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/DigestRepresentation.java index 4f7863e10e..890658e6af 100644 --- a/modules/org.restlet/src/org/restlet/resource/DigestRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/DigestRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.InputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/DomRepresentation.java b/modules/org.restlet/src/org/restlet/representation/DomRepresentation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/DomRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/DomRepresentation.java index d6af8c698b..bdf74d68b6 100644 --- a/modules/org.restlet/src/org/restlet/resource/DomRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/DomRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.OutputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/FileRepresentation.java b/modules/org.restlet/src/org/restlet/representation/FileRepresentation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/FileRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/FileRepresentation.java index 146bee302f..cf0bfe2cf5 100644 --- a/modules/org.restlet/src/org/restlet/resource/FileRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/FileRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.File; import java.io.FileInputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/InputRepresentation.java b/modules/org.restlet/src/org/restlet/representation/InputRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/InputRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/InputRepresentation.java index 54a5ff8ae0..0a6959b81a 100644 --- a/modules/org.restlet/src/org/restlet/resource/InputRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/InputRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.InputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/ObjectRepresentation.java b/modules/org.restlet/src/org/restlet/representation/ObjectRepresentation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/ObjectRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/ObjectRepresentation.java index 8f15bde26d..71577f12b3 100644 --- a/modules/org.restlet/src/org/restlet/resource/ObjectRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/ObjectRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.ObjectInputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/OutputRepresentation.java b/modules/org.restlet/src/org/restlet/representation/OutputRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/OutputRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/OutputRepresentation.java index b825f36627..5c0e8f3905 100644 --- a/modules/org.restlet/src/org/restlet/resource/OutputRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/OutputRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.InputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/RdfRepresentation.java b/modules/org.restlet/src/org/restlet/representation/RdfRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/RdfRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/RdfRepresentation.java index 8a20ed68b4..fb4f4e87da 100644 --- a/modules/org.restlet/src/org/restlet/resource/RdfRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/RdfRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.OutputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/ReadableRepresentation.java b/modules/org.restlet/src/org/restlet/representation/ReadableRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/ReadableRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/ReadableRepresentation.java index d185df0de3..7333f97359 100644 --- a/modules/org.restlet/src/org/restlet/resource/ReadableRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/ReadableRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.nio.channels.ReadableByteChannel; diff --git a/modules/org.restlet/src/org/restlet/resource/ReaderRepresentation.java b/modules/org.restlet/src/org/restlet/representation/ReaderRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/ReaderRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/ReaderRepresentation.java index 9034aff0ea..79c6997232 100644 --- a/modules/org.restlet/src/org/restlet/resource/ReaderRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/ReaderRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.Reader; diff --git a/modules/org.restlet/src/org/restlet/resource/Representation.java b/modules/org.restlet/src/org/restlet/representation/Representation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/Representation.java rename to modules/org.restlet/src/org/restlet/representation/Representation.java index 9616556a50..d7a1a649e9 100644 --- a/modules/org.restlet/src/org/restlet/resource/Representation.java +++ b/modules/org.restlet/src/org/restlet/representation/Representation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/modules/org.restlet/src/org/restlet/resource/SaxRepresentation.java b/modules/org.restlet/src/org/restlet/representation/SaxRepresentation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/SaxRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/SaxRepresentation.java index 7b7e44d010..7165f207e7 100644 --- a/modules/org.restlet/src/org/restlet/resource/SaxRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/SaxRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.OutputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/StreamRepresentation.java b/modules/org.restlet/src/org/restlet/representation/StreamRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/StreamRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/StreamRepresentation.java index 80f9cde8c5..60212f16fa 100644 --- a/modules/org.restlet/src/org/restlet/resource/StreamRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/StreamRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.Reader; diff --git a/modules/org.restlet/src/org/restlet/resource/StringRepresentation.java b/modules/org.restlet/src/org/restlet/representation/StringRepresentation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/StringRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/StringRepresentation.java index 8f38906b1a..6dd0b51277 100644 --- a/modules/org.restlet/src/org/restlet/resource/StringRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/StringRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/modules/org.restlet/src/org/restlet/resource/TransformRepresentation.java b/modules/org.restlet/src/org/restlet/representation/TransformRepresentation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/TransformRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/TransformRepresentation.java index 4862247080..b455808aa4 100644 --- a/modules/org.restlet/src/org/restlet/resource/TransformRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/TransformRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.OutputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/Variant.java b/modules/org.restlet/src/org/restlet/representation/Variant.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/Variant.java rename to modules/org.restlet/src/org/restlet/representation/Variant.java index dd22aa95d1..8bbf19735b 100644 --- a/modules/org.restlet/src/org/restlet/resource/Variant.java +++ b/modules/org.restlet/src/org/restlet/representation/Variant.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.util.Collection; import java.util.Iterator; diff --git a/modules/org.restlet/src/org/restlet/resource/WritableRepresentation.java b/modules/org.restlet/src/org/restlet/representation/WritableRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/WritableRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/WritableRepresentation.java index 1894a9fb00..b649efb22f 100644 --- a/modules/org.restlet/src/org/restlet/resource/WritableRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/WritableRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.nio.channels.ReadableByteChannel; diff --git a/modules/org.restlet/src/org/restlet/resource/WriterRepresentation.java b/modules/org.restlet/src/org/restlet/representation/WriterRepresentation.java similarity index 98% rename from modules/org.restlet/src/org/restlet/resource/WriterRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/WriterRepresentation.java index 564c98ec1f..00bdfadef5 100644 --- a/modules/org.restlet/src/org/restlet/resource/WriterRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/WriterRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.io.OutputStream; diff --git a/modules/org.restlet/src/org/restlet/resource/XmlRepresentation.java b/modules/org.restlet/src/org/restlet/representation/XmlRepresentation.java similarity index 99% rename from modules/org.restlet/src/org/restlet/resource/XmlRepresentation.java rename to modules/org.restlet/src/org/restlet/representation/XmlRepresentation.java index 75c78e663c..037efee60f 100644 --- a/modules/org.restlet/src/org/restlet/resource/XmlRepresentation.java +++ b/modules/org.restlet/src/org/restlet/representation/XmlRepresentation.java @@ -25,7 +25,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.resource; +package org.restlet.representation; import java.io.IOException; import java.util.ArrayList; diff --git a/modules/org.restlet/src/org/restlet/resource/package.html b/modules/org.restlet/src/org/restlet/representation/package.html similarity index 76% rename from modules/org.restlet/src/org/restlet/resource/package.html rename to modules/org.restlet/src/org/restlet/representation/package.html index 0c4a3d1257..6dbd4e6156 100644 --- a/modules/org.restlet/src/org/restlet/resource/package.html +++ b/modules/org.restlet/src/org/restlet/representation/package.html @@ -2,6 +2,6 @@ <BODY> Common resource and representation data elements. -@since Restlet 1.0 +@since Restlet 1.2 </BODY> </HTML> \ No newline at end of file diff --git a/modules/org.restlet/src/org/restlet/resource/ClientResource.java b/modules/org.restlet/src/org/restlet/resource/ClientResource.java index 0fa1a40d16..7aed391b0e 100644 --- a/modules/org.restlet/src/org/restlet/resource/ClientResource.java +++ b/modules/org.restlet/src/org/restlet/resource/ClientResource.java @@ -46,6 +46,8 @@ import org.restlet.data.Reference; import org.restlet.data.Request; import org.restlet.data.Response; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.util.Series; /** diff --git a/modules/org.restlet/src/org/restlet/resource/Resource.java b/modules/org.restlet/src/org/restlet/resource/Resource.java index 3d8ad69eb9..ecdd01f368 100644 --- a/modules/org.restlet/src/org/restlet/resource/Resource.java +++ b/modules/org.restlet/src/org/restlet/resource/Resource.java @@ -40,6 +40,8 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.util.Series; /** @@ -88,7 +90,7 @@ * @see <a * href="http://www.restlet.org/documentation/1.1/tutorial#part12">Tutorial * : Reaching target Resources</a> - * @see org.restlet.resource.Representation + * @see org.restlet.representation.Representation * @see org.restlet.Finder * @author Jerome Louvel * @author Thierry Boileau diff --git a/modules/org.restlet/src/org/restlet/resource/ServerResource.java b/modules/org.restlet/src/org/restlet/resource/ServerResource.java index fa29dc6e90..89d70ce49b 100644 --- a/modules/org.restlet/src/org/restlet/resource/ServerResource.java +++ b/modules/org.restlet/src/org/restlet/resource/ServerResource.java @@ -42,6 +42,8 @@ import org.restlet.data.Response; import org.restlet.data.ServerInfo; import org.restlet.data.Status; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.util.Series; /** diff --git a/modules/org.restlet/src/org/restlet/resource/UniformResource.java b/modules/org.restlet/src/org/restlet/resource/UniformResource.java index 496d93d967..1b58f5ad2a 100644 --- a/modules/org.restlet/src/org/restlet/resource/UniformResource.java +++ b/modules/org.restlet/src/org/restlet/resource/UniformResource.java @@ -50,6 +50,8 @@ import org.restlet.data.Response; import org.restlet.data.ServerInfo; import org.restlet.data.Status; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.util.Series; /** diff --git a/modules/org.restlet/src/org/restlet/service/ConnectorService.java b/modules/org.restlet/src/org/restlet/service/ConnectorService.java index 9cfc95f159..0fcd185602 100644 --- a/modules/org.restlet/src/org/restlet/service/ConnectorService.java +++ b/modules/org.restlet/src/org/restlet/service/ConnectorService.java @@ -32,7 +32,7 @@ import org.restlet.Application; import org.restlet.data.Protocol; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Service declaring client and server connectors. This is useful at deployment diff --git a/modules/org.restlet/src/org/restlet/service/ConverterService.java b/modules/org.restlet/src/org/restlet/service/ConverterService.java index f0e192a6d3..ba6e170fc1 100644 --- a/modules/org.restlet/src/org/restlet/service/ConverterService.java +++ b/modules/org.restlet/src/org/restlet/service/ConverterService.java @@ -27,9 +27,9 @@ package org.restlet.service; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; +import org.restlet.representation.Variant; import org.restlet.resource.UniformResource; -import org.restlet.resource.Variant; /** * Service converting between representation and regular Java objects. The diff --git a/modules/org.restlet/src/org/restlet/service/StatusService.java b/modules/org.restlet/src/org/restlet/service/StatusService.java index e0ec22d0fa..d6ac71f641 100644 --- a/modules/org.restlet/src/org/restlet/service/StatusService.java +++ b/modules/org.restlet/src/org/restlet/service/StatusService.java @@ -31,7 +31,7 @@ import org.restlet.data.Request; import org.restlet.data.Response; import org.restlet.data.Status; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Service to handle error statuses. If an exception is thrown within your diff --git a/modules/org.restlet/src/org/restlet/util/WrapperRepresentation.java b/modules/org.restlet/src/org/restlet/util/WrapperRepresentation.java index 4313d743f3..cbf6618451 100644 --- a/modules/org.restlet/src/org/restlet/util/WrapperRepresentation.java +++ b/modules/org.restlet/src/org/restlet/util/WrapperRepresentation.java @@ -45,7 +45,7 @@ import org.restlet.data.Range; import org.restlet.data.Reference; import org.restlet.data.Tag; -import org.restlet.resource.Representation; +import org.restlet.representation.Representation; /** * Representation wrapper. Useful for application developer who need to enrich diff --git a/modules/org.restlet/src/org/restlet/util/WrapperRequest.java b/modules/org.restlet/src/org/restlet/util/WrapperRequest.java index 437206f96d..fbdf8c0429 100644 --- a/modules/org.restlet/src/org/restlet/util/WrapperRequest.java +++ b/modules/org.restlet/src/org/restlet/util/WrapperRequest.java @@ -39,9 +39,9 @@ import org.restlet.data.Protocol; import org.restlet.data.Reference; import org.restlet.data.Request; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; -import org.restlet.resource.SaxRepresentation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.SaxRepresentation; /** * Request wrapper. Useful for application developer who need to enrich the diff --git a/modules/org.restlet/src/org/restlet/util/WrapperResponse.java b/modules/org.restlet/src/org/restlet/util/WrapperResponse.java index 3de8570893..7d324c0bc5 100644 --- a/modules/org.restlet/src/org/restlet/util/WrapperResponse.java +++ b/modules/org.restlet/src/org/restlet/util/WrapperResponse.java @@ -42,9 +42,9 @@ import org.restlet.data.Response; import org.restlet.data.ServerInfo; import org.restlet.data.Status; -import org.restlet.resource.DomRepresentation; -import org.restlet.resource.Representation; -import org.restlet.resource.SaxRepresentation; +import org.restlet.representation.DomRepresentation; +import org.restlet.representation.Representation; +import org.restlet.representation.SaxRepresentation; /** * Request wrapper. Useful for application developer who need to enrich the
9224f75d331c31c1cd81b55829ba90b04762ac78
kotlin
Tests for match--
p
https://github.com/JetBrains/kotlin
diff --git a/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java b/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java index 08e69476029f5..06a4d1642c8f3 100644 --- a/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java +++ b/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java @@ -392,6 +392,7 @@ private void parseMatchEntry() { myJetParsing.parseAttributeList(); + myBuilder.disableEols(); expect(CASE_KEYWORD, "Expecting 'case' to start pattern matching", TokenSet.create(RBRACE, IF_KEYWORD, DOUBLE_ARROW)); parsePattern(); @@ -403,6 +404,7 @@ private void parseMatchEntry() { } expect(DOUBLE_ARROW, "Expecting '=>'", TokenSet.create(RBRACE)); + myBuilder.enableEols(); parseExpression(); diff --git a/idea/testData/psi/Match.jet b/idea/testData/psi/Match.jet new file mode 100644 index 0000000000000..e56c458d7a036 --- /dev/null +++ b/idea/testData/psi/Match.jet @@ -0,0 +1,31 @@ +fun foo() { + e match { + + } + e match { + case a => foo + } + e match { + case Tree(a, b) => foo + case Tree(a, b) if (a > 5) => foo + case null => foo + case 1 => foo + case A.b => foo + case 1l => foo + case 1.0 => foo + case 'c' => foo + case "sadfsa" => foo + case """ddd""" => foo + case ? => foo + case ? : Foo => foo + case ?a : Foo => foo + case (?a : Foo, b) => foo + } + e match { + + } match { + + } match { + + } +} \ No newline at end of file diff --git a/idea/testData/psi/Match.txt b/idea/testData/psi/Match.txt new file mode 100644 index 0000000000000..12f3fa923c0d3 --- /dev/null +++ b/idea/testData/psi/Match.txt @@ -0,0 +1,294 @@ +JetFile: Match.jet + NAMESPACE + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + <empty list> + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('Tree') + TUPLE_PATTERN + PsiElement(LPAR)('(') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('b') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('Tree') + TUPLE_PATTERN + PsiElement(LPAR)('(') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('a') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('b') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('5') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + NULL + PsiElement(null)('null') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('A') + PsiElement(DOT)('.') + USER_TYPE + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + LONG_CONSTANT + PsiElement(LONG_LITERAL)('1l') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + FLOAT_CONSTANT + PsiElement(FLOAT_CONSTANT)('1.0') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + CHARACTER_CONSTANT + PsiElement(CHARACTER_LITERAL)(''c'') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + STRING_CONSTANT + PsiElement(STRING_LITERAL)('"sadfsa"') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + STRING_CONSTANT + PsiElement(RAW_STRING_LITERAL)('"""ddd"""') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + PsiElement(QUEST)('?') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + PsiElement(QUEST)('?') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + PsiElement(QUEST)('?') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('Foo') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + TUPLE_PATTERN + PsiElement(LPAR)('(') + PATTERN + PsiElement(QUEST)('?') + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('Foo') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('b') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + BINARY_EXPRESSION + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/Match_ERR.jet b/idea/testData/psi/Match_ERR.jet new file mode 100644 index 0000000000000..23383a14649a1 --- /dev/null +++ b/idea/testData/psi/Match_ERR.jet @@ -0,0 +1,24 @@ +fun foo() { + e match { + + } + e match { + case => foo + } + e match { + case => ; + } + e match { + foo bar + case a => foo + } + e match { + foo bar + } + e match { + case - => foo + case (, , 1, , ) => foo + } match { + + } +} \ No newline at end of file diff --git a/idea/testData/psi/Match_ERR.txt b/idea/testData/psi/Match_ERR.txt new file mode 100644 index 0000000000000..ffa22fa934813 --- /dev/null +++ b/idea/testData/psi/Match_ERR.txt @@ -0,0 +1,160 @@ +JetFile: Match_ERR.jet + NAMESPACE + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + TYPE_PARAMETER_LIST + <empty list> + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + PsiErrorElement:Pattern expected + <empty list> + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + PsiErrorElement:Pattern expected + <empty list> + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting an expression + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PsiErrorElement:Expecting 'case' to start pattern matching + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PsiErrorElement:Expecting 'case' to start pattern matching + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + PsiErrorElement:Pattern expected + PsiElement(MINUS)('-') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + TUPLE_PATTERN + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a pattern + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a pattern + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PATTERN + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PsiErrorElement:Expecting a pattern + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + PATTERN + PsiErrorElement:Pattern expected + PsiElement(RPAR)(')') + PsiErrorElement:Expecting ')' + <empty list> + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/NewlinesInParentheses.jet b/idea/testData/psi/NewlinesInParentheses.jet index b7d148e6a6736..3ec6b6fe8d23a 100644 --- a/idea/testData/psi/NewlinesInParentheses.jet +++ b/idea/testData/psi/NewlinesInParentheses.jet @@ -19,4 +19,9 @@ fun foo() { val a = b[{c + d} + d] + + e match { + case A + () => foo; + } } \ No newline at end of file diff --git a/idea/testData/psi/NewlinesInParentheses.txt b/idea/testData/psi/NewlinesInParentheses.txt index 32be1be06b6ae..f20bec9a41bbf 100644 --- a/idea/testData/psi/NewlinesInParentheses.txt +++ b/idea/testData/psi/NewlinesInParentheses.txt @@ -188,5 +188,30 @@ JetFile: NewlinesInParentheses.jet PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('d') PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('e') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + MATCH_ENTRY + PsiElement(case)('case') + PsiWhiteSpace(' ') + PATTERN + USER_TYPE + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace('\n ') + TUPLE_PATTERN + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/Precedence.jet b/idea/testData/psi/Precedence.jet index 3f0eef4ff7a4a..62287bd629442 100644 --- a/idea/testData/psi/Precedence.jet +++ b/idea/testData/psi/Precedence.jet @@ -32,4 +32,7 @@ fun foo() { a || b && c a = b -> c a = b || c + a = b || c match {} match {} + a = b || c match {} + a = a -> c match {} -> c } \ No newline at end of file diff --git a/idea/testData/psi/Precedence.txt b/idea/testData/psi/Precedence.txt index ca76a85590760..418b543f751dd 100644 --- a/idea/testData/psi/Precedence.txt +++ b/idea/testData/psi/Precedence.txt @@ -518,5 +518,70 @@ JetFile: Precedence.jet PsiElement(OROR)('||') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('c') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + BINARY_EXPRESSION + BINARY_EXPRESSION + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + PsiElement(OROR)('||') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('c') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + BINARY_EXPRESSION + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace(' ') + PsiElement(OROR)('||') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('c') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + BINARY_EXPRESSION + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + BINARY_EXPRESSION + PsiElement(IDENTIFIER)('c') + PsiWhiteSpace(' ') + PsiElement(match)('match') + PsiWhiteSpace(' ') + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('c') PsiWhiteSpace('\n') PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java b/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java index e9cd617bc8c59..fd957c86683e7 100644 --- a/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java +++ b/idea/tests/org/jetbrains/jet/parsing/JetParsingTest.java @@ -52,6 +52,8 @@ private static String getHomeDirectory() { public void testImports_ERR() throws Exception {doTest(true);} public void testImportSoftKW() throws Exception {doTest(true);} public void testLocalDeclarations() throws Exception {doTest(true);} + public void testMatch() throws Exception {doTest(true);} + public void testMatch_ERR() throws Exception {doTest(true);} public void testNamespaceBlock_ERR() throws Exception {doTest(true);} public void testNamespaceBlock() throws Exception {doTest(true);} public void testNewlinesInParentheses() throws Exception {doTest(true);}
073c256399303ba7569f817f9c8e604628fed071
orientdb
Fixed issue 684 about strict mode--
c
https://github.com/orientechnologies/orientdb
diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentValidationTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentValidationTest.java index d2799bd5661..961b7bf1411 100644 --- a/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentValidationTest.java +++ b/tests/src/test/java/com/orientechnologies/orient/test/database/auto/CRUDDocumentValidationTest.java @@ -90,7 +90,17 @@ public void validationEmbeddedType() throws ParseException { record.save(); } - @Test(dependsOnMethods = "validationEmbeddedType") + + @Test(dependsOnMethods = "validationEmbeddedType", expectedExceptions = OValidationException.class) + public void validationStrictClass() throws ParseException { + ODocument doc = new ODocument("StrictTest"); + doc.field("id", 122112); + doc.field("antani", "122112"); + doc.save(); + } + + + @Test(dependsOnMethods = "validationStrictClass") public void closeDb() { database.close(); }
6ebf6a1c3a48f4b3f18bfe4e42f86e1b3b8398a2
orientdb
HTTP static content now supports single file as- configuration--
a
https://github.com/orientechnologies/orientdb
diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetStaticContent.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetStaticContent.java index d1ce5c3bea7..6c36d1286f2 100644 --- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetStaticContent.java +++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/command/get/OServerCommandGetStaticContent.java @@ -38,11 +38,14 @@ public class OServerCommandGetStaticContent extends OServerCommandConfigurableAb "GET|*.swf", "GET|favicon.ico", "GET|robots.txt" }; private static final String CONFIG_HTTP_CACHE = "http.cache:"; + private static final String CONFIG_ROOT_PATH = "root.path"; + private static final String CONFIG_FILE_PATH = "file.path"; private Map<String, OStaticContentCachedEntry> cacheContents; private Map<String, String> cacheHttp = new HashMap<String, String>(); private String cacheHttpDefault = "Cache-Control: max-age=3000"; - private String wwwPath; + private String rootPath; + private String filePath; public OServerCommandGetStaticContent() { super(DEF_PATTERN); @@ -63,7 +66,11 @@ else if (filter.length() > 0) { cacheHttp.put(f, par.value); } } - } + } else if (par.name.startsWith(CONFIG_ROOT_PATH)) + rootPath = par.value; + else if (par.name.startsWith(CONFIG_FILE_PATH)) + filePath = par.value; + } } @@ -72,14 +79,23 @@ public boolean execute(final OHttpRequest iRequest) throws Exception { iRequest.data.commandInfo = "Get static content"; iRequest.data.commandDetail = iRequest.url; - if (wwwPath == null) { - wwwPath = iRequest.configuration.getValueAsString("orientdb.www.path", "src/site"); + if (filePath == null && rootPath == null) { + // GET GLOBAL CONFIG + rootPath = iRequest.configuration.getValueAsString("orientdb.www.path", "src/site"); + if (rootPath == null) { + OLogManager.instance().warn(this, + "No path configured. Specify the 'root.path', 'file.path' or the global 'orientdb.www.path' variable", rootPath); + return false; + } + } - final File wwwPathDirectory = new File(wwwPath); + if (filePath == null) { + // CHECK DIRECTORY + final File wwwPathDirectory = new File(rootPath); if (!wwwPathDirectory.exists()) - OLogManager.instance().warn(this, "orientdb.www.path variable points to '%s' but it doesn't exists", wwwPath); + OLogManager.instance().warn(this, "path variable points to '%s' but it doesn't exists", rootPath); if (!wwwPathDirectory.isDirectory()) - OLogManager.instance().warn(this, "orientdb.www.path variable points to '%s' but it isn't a directory", wwwPath); + OLogManager.instance().warn(this, "path variable points to '%s' but it isn't a directory", rootPath); } if (cacheContents == null && OGlobalConfiguration.SERVER_CACHE_FILE_STATIC.getValueAsBoolean()) @@ -91,18 +107,22 @@ public boolean execute(final OHttpRequest iRequest) throws Exception { String type = null; try { - final String url = getResource(iRequest); - - String filePath; - // REPLACE WWW WITH REAL PATH - if (url.startsWith("/www")) - filePath = wwwPath + url.substring("/www".length(), url.length()); - else - filePath = wwwPath + url; + String path; + if (filePath != null) + // SINGLE FILE + path = filePath; + else { + // GET FROM A DIRECTORY + final String url = getResource(iRequest); + if (url.startsWith("/www")) + path = rootPath + url.substring("/www".length(), url.length()); + else + path = rootPath + url; + } if (cacheContents != null) { synchronized (cacheContents) { - final OStaticContentCachedEntry cachedEntry = cacheContents.get(filePath); + final OStaticContentCachedEntry cachedEntry = cacheContents.get(path); if (cachedEntry != null) { is = new ByteArrayInputStream(cachedEntry.content); contentSize = cachedEntry.size; @@ -112,38 +132,38 @@ public boolean execute(final OHttpRequest iRequest) throws Exception { } if (is == null) { - File inputFile = new File(filePath); + File inputFile = new File(path); if (!inputFile.exists()) { - OLogManager.instance().debug(this, "Static resource not found: %s", filePath); + OLogManager.instance().debug(this, "Static resource not found: %s", path); sendBinaryContent(iRequest, 404, "File not found", null, null, 0); return false; } - if (inputFile.isDirectory()) { - inputFile = new File(filePath + "/index.htm"); + if (filePath == null && inputFile.isDirectory()) { + inputFile = new File(path + "/index.htm"); if (inputFile.exists()) - filePath = url + "/index.htm"; + path = path + "/index.htm"; else { - inputFile = new File(url + "/index.html"); + inputFile = new File(path + "/index.html"); if (inputFile.exists()) - filePath = url + "/index.html"; + path = path + "/index.html"; } } - if (filePath.endsWith(".htm") || filePath.endsWith(".html")) + if (path.endsWith(".htm") || path.endsWith(".html")) type = "text/html"; - else if (filePath.endsWith(".png")) + else if (path.endsWith(".png")) type = "image/png"; - else if (filePath.endsWith(".jpeg")) + else if (path.endsWith(".jpeg")) type = "image/jpeg"; - else if (filePath.endsWith(".js")) + else if (path.endsWith(".js")) type = "application/x-javascript"; - else if (filePath.endsWith(".css")) + else if (path.endsWith(".css")) type = "text/css"; - else if (filePath.endsWith(".ico")) + else if (path.endsWith(".ico")) type = "image/x-icon"; - else if (filePath.endsWith(".otf")) + else if (path.endsWith(".otf")) type = "font/opentype"; else type = "text/plain"; @@ -162,7 +182,7 @@ else if (filePath.endsWith(".otf")) cachedEntry.size = contentSize; cachedEntry.type = type; - cacheContents.put(url, cachedEntry); + cacheContents.put(path, cachedEntry); is = new ByteArrayInputStream(cachedEntry.content); }
8ccfca3a2f0193f0a4da38e206c35cf08402218f
elasticsearch
Fielddata: Remove- BytesValues.WithOrdinals.currentOrd and copyShared.--These methods don't exist in Lucene's sorted set doc values.--Relates to -6524-
p
https://github.com/elastic/elasticsearch
diff --git a/src/main/java/org/elasticsearch/index/fielddata/AtomicFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/AtomicFieldData.java index 10afc29ec1154..21188c0f3e9f4 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/AtomicFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/AtomicFieldData.java @@ -19,10 +19,8 @@ package org.elasticsearch.index.fielddata; -import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; import org.elasticsearch.index.fielddata.ScriptDocValues.Strings; -import org.elasticsearch.index.fielddata.plain.AtomicFieldDataWithOrdinalsTermsEnum; /** * The thread safe {@link org.apache.lucene.index.AtomicReader} level cache of the data. @@ -90,19 +88,9 @@ public long getOrd(int docId) { public long getMaxOrd() { return 0; } - - @Override - public long currentOrd() { - return MISSING_ORDINAL; - } }; } - @Override - public TermsEnum getTermsEnum() { - return new AtomicFieldDataWithOrdinalsTermsEnum(this); - } - }; /** @@ -111,11 +99,6 @@ public TermsEnum getTermsEnum() { */ BytesValues.WithOrdinals getBytesValues(); - /** - * Returns a terms enum to iterate over all the underlying values. - */ - TermsEnum getTermsEnum(); - } /** diff --git a/src/main/java/org/elasticsearch/index/fielddata/BytesValues.java b/src/main/java/org/elasticsearch/index/fielddata/BytesValues.java index ae15105d5ee87..fb615ac6703d3 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/BytesValues.java +++ b/src/main/java/org/elasticsearch/index/fielddata/BytesValues.java @@ -20,8 +20,10 @@ package org.elasticsearch.index.fielddata; import org.apache.lucene.index.SortedSetDocValues; +import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; import org.elasticsearch.ElasticsearchIllegalStateException; +import org.elasticsearch.index.fielddata.plain.BytesValuesWithOrdinalsTermsEnum; /** * A state-full lightweight per document set of <code>byte[]</code> values. @@ -60,15 +62,6 @@ public final boolean isMultiValued() { return multiValued; } - /** - * Converts the current shared {@link BytesRef} to a stable instance. Note, - * this calls makes the bytes safe for *reads*, not writes (into the same BytesRef). For example, - * it makes it safe to be placed in a map. - */ - public BytesRef copyShared() { - return BytesRef.deepCopyOf(scratch); - } - /** * Sets iteration to the specified docID and returns the number of * values for this document ID, @@ -139,12 +132,6 @@ protected WithOrdinals(boolean multiValued) { */ public abstract long nextOrd(); - /** - * Returns the current ordinal in the iteration - * @return the current ordinal in the iteration - */ - public abstract long currentOrd(); - /** * Returns the value for the given ordinal. * @param ord the ordinal to lookup. @@ -157,6 +144,13 @@ protected WithOrdinals(boolean multiValued) { public BytesRef nextValue() { return getValueByOrd(nextOrd()); } + + /** + * Returns a terms enum to iterate over all the underlying values. + */ + public TermsEnum getTermsEnum() { + return new BytesValuesWithOrdinalsTermsEnum(this); + } } /** diff --git a/src/main/java/org/elasticsearch/index/fielddata/ordinals/GlobalOrdinalMapping.java b/src/main/java/org/elasticsearch/index/fielddata/ordinals/GlobalOrdinalMapping.java index 9b9d93ac8ba8e..d7b690db90a8f 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/ordinals/GlobalOrdinalMapping.java +++ b/src/main/java/org/elasticsearch/index/fielddata/ordinals/GlobalOrdinalMapping.java @@ -43,11 +43,6 @@ public class GlobalOrdinalMapping extends BytesValues.WithOrdinals { int readerIndex; - @Override - public BytesRef copyShared() { - return bytesValues[readerIndex].copyShared(); - } - @Override public long getMaxOrd() { return ordinalMap.getValueCount(); @@ -67,11 +62,6 @@ public long nextOrd() { return getGlobalOrd(values.nextOrd()); } - @Override - public long currentOrd() { - return getGlobalOrd(values.currentOrd()); - } - @Override public int setDocument(int docId) { return values.setDocument(docId); diff --git a/src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsBuilder.java b/src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsBuilder.java index e9f721147d7a1..03307bd7c8ce3 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsBuilder.java +++ b/src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsBuilder.java @@ -49,7 +49,7 @@ public IndexFieldData.WithOrdinals build(final IndexReader indexReader, IndexFie final TermsEnum[] subs = new TermsEnum[indexReader.leaves().size()]; for (int i = 0; i < indexReader.leaves().size(); ++i) { atomicFD[i] = indexFieldData.load(indexReader.leaves().get(i)); - subs[i] = atomicFD[i].getTermsEnum(); + subs[i] = atomicFD[i].getBytesValues().getTermsEnum(); } final OrdinalMap ordinalMap = new OrdinalMap(null, subs); final long memorySizeInBytes = ordinalMap.ramBytesUsed(); diff --git a/src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsIndexFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsIndexFieldData.java index 9007eabf6cb8c..d6f8b9bfba988 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsIndexFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsIndexFieldData.java @@ -20,14 +20,12 @@ import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.MultiDocValues.OrdinalMap; -import org.apache.lucene.index.TermsEnum; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.fielddata.AtomicFieldData; import org.elasticsearch.index.fielddata.BytesValues; import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.fielddata.ScriptDocValues; -import org.elasticsearch.index.fielddata.plain.AtomicFieldDataWithOrdinalsTermsEnum; import org.elasticsearch.index.mapper.FieldMapper; /** @@ -86,11 +84,6 @@ public ScriptDocValues getScriptValues() { throw new UnsupportedOperationException("Script values not supported on global ordinals"); } - @Override - public TermsEnum getTermsEnum() { - return new AtomicFieldDataWithOrdinalsTermsEnum(this); - } - @Override public void close() { } diff --git a/src/main/java/org/elasticsearch/index/fielddata/ordinals/MultiOrdinals.java b/src/main/java/org/elasticsearch/index/fielddata/ordinals/MultiOrdinals.java index 9dd61999d6e49..7d0f53acb4afe 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/ordinals/MultiOrdinals.java +++ b/src/main/java/org/elasticsearch/index/fielddata/ordinals/MultiOrdinals.java @@ -93,7 +93,6 @@ public static class MultiDocs extends BytesValues.WithOrdinals { private final AppendingPackedLongBuffer ords; private long offset; private long limit; - private long currentOrd; private final ValuesHolder values; MultiDocs(MultiOrdinals ordinals, ValuesHolder values) { @@ -114,16 +113,16 @@ public long getOrd(int docId) { final long startOffset = docId > 0 ? endOffsets.get(docId - 1) : 0; final long endOffset = endOffsets.get(docId); if (startOffset == endOffset) { - return currentOrd = MISSING_ORDINAL; // ord for missing values + return MISSING_ORDINAL; // ord for missing values } else { - return currentOrd = ords.get(startOffset); + return ords.get(startOffset); } } @Override public long nextOrd() { assert offset < limit; - return currentOrd = ords.get(offset++); + return ords.get(offset++); } @Override @@ -135,19 +134,9 @@ public int setDocument(int docId) { return (int) (endOffset - startOffset); } - @Override - public long currentOrd() { - return currentOrd; - } - @Override public BytesRef getValueByOrd(long ord) { return values.getValueByOrd(ord); } - - @Override - public BytesRef copyShared() { - return values.copy(scratch); - } } } diff --git a/src/main/java/org/elasticsearch/index/fielddata/ordinals/SinglePackedOrdinals.java b/src/main/java/org/elasticsearch/index/fielddata/ordinals/SinglePackedOrdinals.java index 5a00b1d089aaf..ea31542382ddf 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/ordinals/SinglePackedOrdinals.java +++ b/src/main/java/org/elasticsearch/index/fielddata/ordinals/SinglePackedOrdinals.java @@ -95,19 +95,9 @@ public int setDocument(int docId) { return 1 + (int) Math.min(currentOrdinal, 0); } - @Override - public long currentOrd() { - return currentOrdinal; - } - @Override public BytesRef getValueByOrd(long ord) { return values.getValueByOrd(ord); } - - @Override - public BytesRef copyShared() { - return values.copy(scratch); - } } } diff --git a/src/main/java/org/elasticsearch/index/fielddata/plain/FSTBytesAtomicFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/plain/FSTBytesAtomicFieldData.java index 3bbc9f1c62db4..25360570bf789 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/plain/FSTBytesAtomicFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/plain/FSTBytesAtomicFieldData.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.index.fielddata.plain; -import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.IntsRef; import org.apache.lucene.util.fst.FST; diff --git a/src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java index 062407769d4bc..b18ab993e616b 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java @@ -21,7 +21,6 @@ import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.IndexReader; -import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; @@ -75,11 +74,6 @@ public long getMaxOrd() { return 1; } - @Override - public long currentOrd() { - return BytesValues.WithOrdinals.MIN_ORDINAL; - } - @Override public BytesRef getValueByOrd(long ord) { return scratch; @@ -114,11 +108,6 @@ public ScriptDocValues getScriptValues() { public void close() { } - @Override - public TermsEnum getTermsEnum() { - return new AtomicFieldDataWithOrdinalsTermsEnum(this); - } - } private final FieldMapper.Names names; diff --git a/src/main/java/org/elasticsearch/index/fielddata/plain/PagedBytesAtomicFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/plain/PagedBytesAtomicFieldData.java index bc590ec7d3b36..38451424ceaac 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/plain/PagedBytesAtomicFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/plain/PagedBytesAtomicFieldData.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.index.fielddata.plain; -import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.PagedBytes; import org.apache.lucene.util.packed.MonotonicAppendingLongBuffer; diff --git a/src/main/java/org/elasticsearch/index/fielddata/plain/ParentChildAtomicFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/plain/ParentChildAtomicFieldData.java index 4babac2caaad4..f380aea9bbf33 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/plain/ParentChildAtomicFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/plain/ParentChildAtomicFieldData.java @@ -68,8 +68,7 @@ public int setDocument(int docId) { int numValues = values.setDocument(docId); assert numValues <= 1 : "Per doc/type combination only a single value is allowed"; if (numValues == 1) { - values.nextValue(); - terms[counter++] = values.copyShared(); + terms[counter++] = BytesRef.deepCopyOf(values.nextValue()); } } assert counter <= 2 : "A single doc can potentially be both parent and child, so the maximum allowed values is 2"; diff --git a/src/main/java/org/elasticsearch/index/fielddata/plain/SortedSetDVAtomicFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/plain/SortedSetDVAtomicFieldData.java index fb7fb6a397b44..b2c028f43454b 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/plain/SortedSetDVAtomicFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/plain/SortedSetDVAtomicFieldData.java @@ -96,7 +96,6 @@ static class SortedSetValues extends BytesValues.WithOrdinals { private final SortedSetDocValues values; private long[] ords; private int ordIndex = Integer.MAX_VALUE; - private long currentOrdinal = -1; SortedSetValues(SortedSetDocValues values) { super(DocValues.unwrapSingleton(values) == null); @@ -112,13 +111,13 @@ public long getMaxOrd() { @Override public long getOrd(int docId) { values.setDocument(docId); - return currentOrdinal = values.nextOrd(); + return values.nextOrd(); } @Override public long nextOrd() { assert ordIndex < ords.length; - return currentOrdinal = ords[ordIndex++]; + return ords[ordIndex++]; } @Override @@ -135,11 +134,6 @@ public int setDocument(int docId) { return i; } - @Override - public long currentOrd() { - return currentOrdinal; - } - @Override public BytesRef getValueByOrd(long ord) { values.lookupOrd(ord, scratch); diff --git a/src/main/java/org/elasticsearch/index/percolator/QueriesLoaderCollector.java b/src/main/java/org/elasticsearch/index/percolator/QueriesLoaderCollector.java index c988eef480c8d..67002ad878825 100644 --- a/src/main/java/org/elasticsearch/index/percolator/QueriesLoaderCollector.java +++ b/src/main/java/org/elasticsearch/index/percolator/QueriesLoaderCollector.java @@ -74,7 +74,7 @@ public void collect(int doc) throws IOException { // id is only used for logging, if we fail we log the id in the catch statement final Query parseQuery = percolator.parsePercolatorDocument(null, fieldsVisitor.source()); if (parseQuery != null) { - queries.put(idValues.copyShared(), parseQuery); + queries.put(BytesRef.deepCopyOf(id), parseQuery); } else { logger.warn("failed to add query [{}] - parser returned null", id); } diff --git a/src/main/java/org/elasticsearch/index/search/child/ParentIdsFilter.java b/src/main/java/org/elasticsearch/index/search/child/ParentIdsFilter.java index 4fbfcd72ec3c1..30460a59ee48c 100644 --- a/src/main/java/org/elasticsearch/index/search/child/ParentIdsFilter.java +++ b/src/main/java/org/elasticsearch/index/search/child/ParentIdsFilter.java @@ -23,14 +23,17 @@ import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.Filter; -import org.apache.lucene.util.*; +import org.apache.lucene.util.Bits; +import org.apache.lucene.util.BytesRef; +import org.apache.lucene.util.FixedBitSet; +import org.apache.lucene.util.LongBitSet; import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.lucene.search.AndFilter; +import org.elasticsearch.common.util.BytesRefHash; import org.elasticsearch.common.util.LongHash; import org.elasticsearch.index.fielddata.BytesValues; import org.elasticsearch.index.mapper.Uid; import org.elasticsearch.index.mapper.internal.UidFieldMapper; -import org.elasticsearch.common.util.BytesRefHash; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; @@ -49,8 +52,7 @@ static Filter createShortCircuitFilter(Filter nonNestedDocsFilter, SearchContext String parentType, BytesValues.WithOrdinals globalValues, LongBitSet parentOrds, long numFoundParents) { if (numFoundParents == 1) { - globalValues.getValueByOrd(parentOrds.nextSetBit(0)); - BytesRef id = globalValues.copyShared(); + BytesRef id = globalValues.getValueByOrd(parentOrds.nextSetBit(0)); if (nonNestedDocsFilter != null) { List<Filter> filters = Arrays.asList( new TermFilter(new Term(UidFieldMapper.NAME, Uid.createUidAsBytes(parentType, id))), @@ -83,8 +85,7 @@ static Filter createShortCircuitFilter(Filter nonNestedDocsFilter, SearchContext String parentType, BytesValues.WithOrdinals globalValues, LongHash parentIdxs, long numFoundParents) { if (numFoundParents == 1) { - globalValues.getValueByOrd(parentIdxs.get(0)); - BytesRef id = globalValues.copyShared(); + BytesRef id = globalValues.getValueByOrd(parentIdxs.get(0)); if (nonNestedDocsFilter != null) { List<Filter> filters = Arrays.asList( new TermFilter(new Term(UidFieldMapper.NAME, Uid.createUidAsBytes(parentType, id))), diff --git a/src/main/java/org/elasticsearch/percolator/PercolatorService.java b/src/main/java/org/elasticsearch/percolator/PercolatorService.java index 8326c79519817..9d1d12c7677b5 100644 --- a/src/main/java/org/elasticsearch/percolator/PercolatorService.java +++ b/src/main/java/org/elasticsearch/percolator/PercolatorService.java @@ -765,7 +765,7 @@ public PercolateShardResponse doPercolate(PercolateShardRequest request, Percola final int numValues = values.setDocument(localDocId); assert numValues == 1; BytesRef bytes = values.nextValue(); - matches.add(values.copyShared()); + matches.add(BytesRef.deepCopyOf(bytes)); if (hls != null) { Query query = context.percolateQueries().get(bytes); context.parsedQuery(new ParsedQuery(query, ImmutableMap.<String, Filter>of())); diff --git a/src/main/java/org/elasticsearch/percolator/QueryCollector.java b/src/main/java/org/elasticsearch/percolator/QueryCollector.java index f26eb447ccbe2..2b75753e4513e 100644 --- a/src/main/java/org/elasticsearch/percolator/QueryCollector.java +++ b/src/main/java/org/elasticsearch/percolator/QueryCollector.java @@ -212,7 +212,7 @@ public void collect(int doc) throws IOException { } if (collector.exists()) { if (!limit || counter < size) { - matches.add(values.copyShared()); + matches.add(BytesRef.deepCopyOf(current)); if (context.highlight() != null) { highlightPhase.hitExecute(context, context.hitContext()); hls.add(context.hitContext().hit().getHighlightFields()); @@ -334,7 +334,7 @@ public void collect(int doc) throws IOException { } if (collector.exists()) { if (!limit || counter < size) { - matches.add(values.copyShared()); + matches.add(BytesRef.deepCopyOf(current)); scores.add(scorer.score()); if (context.highlight() != null) { highlightPhase.hitExecute(context, context.hitContext()); diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java index 5d880322a343a..8c935a6f0738b 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java @@ -376,19 +376,9 @@ public int setDocument(int docId) { return numAcceptedOrds; } - @Override - public long currentOrd() { - return currentOrd; - } - @Override public BytesRef getValueByOrd(long ord) { return inner.getValueByOrd(ord); } - - @Override - public BytesRef copyShared() { - return inner.copyShared(); - } } } diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java index 3767c13fad42c..22b20347a4a2a 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java @@ -89,6 +89,7 @@ public void collect(int doc, long owningBucketOrdinal) throws IOException { } } + // TODO: use terms enum /** Returns an iterator over the field data terms. */ private static Iterator<BytesRef> terms(final BytesValues.WithOrdinals bytesValues, boolean reverse) { if (reverse) { @@ -103,8 +104,7 @@ public boolean hasNext() { @Override public BytesRef next() { - bytesValues.getValueByOrd(i--); - return bytesValues.copyShared(); + return BytesRef.deepCopyOf(bytesValues.getValueByOrd(i--)); } }; @@ -120,8 +120,7 @@ public boolean hasNext() { @Override public BytesRef next() { - bytesValues.getValueByOrd(i++); - return bytesValues.copyShared(); + return BytesRef.deepCopyOf(bytesValues.getValueByOrd(i++)); } }; diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/support/IncludeExclude.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/support/IncludeExclude.java index 517a6511811e2..11a66ad801aad 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/support/IncludeExclude.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/support/IncludeExclude.java @@ -79,7 +79,7 @@ public boolean accept(BytesRef value) { * Computes which global ordinals are accepted by this IncludeExclude instance. */ public LongBitSet acceptedGlobalOrdinals(BytesValues.WithOrdinals globalOrdinals, ValuesSource.Bytes.WithOrdinals valueSource) { - TermsEnum globalTermsEnum = valueSource.getGlobalTermsEnum(); + TermsEnum globalTermsEnum = valueSource.globalBytesValues().getTermsEnum(); LongBitSet acceptedGlobalOrdinals = new LongBitSet(globalOrdinals.getMaxOrd()); try { for (BytesRef term = globalTermsEnum.next(); term != null; term = globalTermsEnum.next()) { diff --git a/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSource.java b/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSource.java index 77e88267d3530..a79ee07477c82 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSource.java +++ b/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSource.java @@ -21,7 +21,6 @@ import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReaderContext; -import org.apache.lucene.index.TermsEnum; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.BytesRef; @@ -176,8 +175,6 @@ public static abstract class WithOrdinals extends Bytes implements TopReaderCont public abstract long globalMaxOrd(IndexSearcher indexSearcher); - public abstract TermsEnum getGlobalTermsEnum(); - public static class FieldData extends WithOrdinals implements ReaderContextAware { protected final IndexFieldData.WithOrdinals<?> indexFieldData; @@ -262,11 +259,6 @@ public long globalMaxOrd(IndexSearcher indexSearcher) { return maxOrd = values.getMaxOrd(); } } - - @Override - public TermsEnum getGlobalTermsEnum() { - return globalAtomicFieldData.getTermsEnum(); - } } } diff --git a/src/main/java/org/elasticsearch/search/facet/terms/strings/TermsStringOrdinalsFacetExecutor.java b/src/main/java/org/elasticsearch/search/facet/terms/strings/TermsStringOrdinalsFacetExecutor.java index 91ec3093dc08a..1d05ea5ceb30c 100644 --- a/src/main/java/org/elasticsearch/search/facet/terms/strings/TermsStringOrdinalsFacetExecutor.java +++ b/src/main/java/org/elasticsearch/search/facet/terms/strings/TermsStringOrdinalsFacetExecutor.java @@ -280,7 +280,7 @@ public boolean nextPosition() { } public BytesRef copyCurrent() { - return values.copyShared(); + return BytesRef.deepCopyOf(current); } @Override diff --git a/src/main/java/org/elasticsearch/search/facet/termsstats/strings/TermsStatsStringFacetExecutor.java b/src/main/java/org/elasticsearch/search/facet/termsstats/strings/TermsStatsStringFacetExecutor.java index 1b62bc5cf0c02..5aff3b64d86ca 100644 --- a/src/main/java/org/elasticsearch/search/facet/termsstats/strings/TermsStatsStringFacetExecutor.java +++ b/src/main/java/org/elasticsearch/search/facet/termsstats/strings/TermsStatsStringFacetExecutor.java @@ -170,7 +170,7 @@ public void onValue(int docId, BytesRef value, int hashCode, BytesValues values) spare.reset(value, hashCode); InternalTermsStatsStringFacet.StringEntry stringEntry = entries.get(spare); if (stringEntry == null) { - HashedBytesRef theValue = new HashedBytesRef(values.copyShared(), hashCode); + HashedBytesRef theValue = new HashedBytesRef(BytesRef.deepCopyOf(value), hashCode); stringEntry = new InternalTermsStatsStringFacet.StringEntry(theValue, 0, 0, 0, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY); entries.put(theValue, stringEntry); } @@ -210,7 +210,7 @@ public void onValue(int docId, BytesRef value, int hashCode, BytesValues values) spare.reset(value, hashCode); InternalTermsStatsStringFacet.StringEntry stringEntry = entries.get(spare); if (stringEntry == null) { - HashedBytesRef theValue = new HashedBytesRef(values.copyShared(), hashCode); + HashedBytesRef theValue = new HashedBytesRef(BytesRef.deepCopyOf(value), hashCode); stringEntry = new InternalTermsStatsStringFacet.StringEntry(theValue, 1, 0, 0, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY); entries.put(theValue, stringEntry); } else { diff --git a/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java index 9bc4d7db61b29..d0f98e2b58648 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java @@ -506,7 +506,7 @@ public void testTermsEnum() throws Exception { IndexFieldData.WithOrdinals ifd = getForField("value"); AtomicFieldData.WithOrdinals afd = ifd.load(atomicReaderContext); - TermsEnum termsEnum = afd.getTermsEnum(); + TermsEnum termsEnum = afd.getBytesValues().getTermsEnum(); int size = 0; while (termsEnum.next() != null) { size++; diff --git a/src/test/java/org/elasticsearch/search/aggregations/support/FieldDataSourceTests.java b/src/test/java/org/elasticsearch/search/aggregations/support/FieldDataSourceTests.java index 299f64c133d73..4f18bd4ee456a 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/support/FieldDataSourceTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/support/FieldDataSourceTests.java @@ -112,40 +112,8 @@ public double runAsDouble() { }; } - private static void assertConsistent(BytesValues values) { - final int numDocs = scaledRandomIntBetween(10, 100); - for (int i = 0; i < numDocs; ++i) { - final int valueCount = values.setDocument(i); - for (int j = 0; j < valueCount; ++j) { - final BytesRef term = values.nextValue(); - assertTrue(term.bytesEquals(values.copyShared())); - } - } - } - - @Test - public void bytesValuesWithScript() { - final BytesValues values = randomBytesValues(); - ValuesSource source = new ValuesSource.Bytes() { - - @Override - public BytesValues bytesValues() { - return values; - } - - @Override - public MetaData metaData() { - throw new UnsupportedOperationException(); - } - - }; - SearchScript script = randomScript(); - assertConsistent(new ValuesSource.WithScript.BytesValues(source, script)); - } - @Test public void sortedUniqueBytesValues() { - assertConsistent(new ValuesSource.Bytes.SortedAndUnique.SortedUniqueBytesValues(randomBytesValues())); assertSortedAndUnique(new ValuesSource.Bytes.SortedAndUnique.SortedUniqueBytesValues(randomBytesValues())); } @@ -160,7 +128,7 @@ private static void assertSortedAndUnique(BytesValues values) { if (j > 0) { assertThat(BytesRef.getUTF8SortedAsUnicodeComparator().compare(ref.get(ref.size() - 1), term), lessThan(0)); } - ref.add(values.copyShared()); + ref.add(BytesRef.deepCopyOf(term)); } } }
ebfb482c3ee955f24be4d2802c1e06d6f0aa0d1c
restlet-framework-java
Removed debug traces.--
p
https://github.com/restlet/restlet-framework-java
diff --git a/modules/org.restlet.ext.odata/src/org/restlet/ext/odata/Query.java b/modules/org.restlet.ext.odata/src/org/restlet/ext/odata/Query.java index 142b1c1b3a..4fee45c339 100755 --- a/modules/org.restlet.ext.odata/src/org/restlet/ext/odata/Query.java +++ b/modules/org.restlet.ext.odata/src/org/restlet/ext/odata/Query.java @@ -328,10 +328,8 @@ public void execute() throws Exception { ClientResource resource = new ClientResource(targetUri); resource.setChallengeResponse(service.getCredentials()); - Representation result = new StringRepresentation(resource.get( - MediaType.APPLICATION_ATOM).getText()); - System.out.println(targetUri); - System.out.println(result.getText()); + Representation result = resource.get(MediaType.APPLICATION_ATOM); + service.setLatestRequest(resource.getRequest()); service.setLatestResponse(resource.getResponse());
dd7cae7c19717429099c98536c0186a0677ed593
elasticsearch
move DatabaseReaders initialization to- IngestGeoIpPlugin-onModule--
p
https://github.com/elastic/elasticsearch
diff --git a/plugins/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpProcessor.java b/plugins/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpProcessor.java index ab87d51318b33..0ffc3cf3a595b 100644 --- a/plugins/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpProcessor.java +++ b/plugins/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpProcessor.java @@ -37,24 +37,17 @@ import java.io.Closeable; import java.io.IOException; -import java.io.InputStream; import java.net.InetAddress; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.PathMatcher; -import java.nio.file.StandardOpenOption; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; -import java.util.stream.Stream; import static org.elasticsearch.ingest.core.ConfigurationUtils.readOptionalList; import static org.elasticsearch.ingest.core.ConfigurationUtils.readStringProperty; @@ -230,31 +223,8 @@ public static final class Factory implements Processor.Factory<GeoIpProcessor>, private final Map<String, DatabaseReader> databaseReaders; - public Factory(Path configDirectory) { - - // TODO(simonw): same as fro grok we should load this outside of the factory in a static method and hass the map to the ctor - Path geoIpConfigDirectory = configDirectory.resolve("ingest-geoip"); - if (Files.exists(geoIpConfigDirectory) == false && Files.isDirectory(geoIpConfigDirectory)) { - throw new IllegalStateException("the geoip directory [" + geoIpConfigDirectory + "] containing databases doesn't exist"); - } - - try (Stream<Path> databaseFiles = Files.list(geoIpConfigDirectory)) { - Map<String, DatabaseReader> databaseReaders = new HashMap<>(); - PathMatcher pathMatcher = geoIpConfigDirectory.getFileSystem().getPathMatcher("glob:**.mmdb"); - // Use iterator instead of forEach otherwise IOException needs to be caught twice... - Iterator<Path> iterator = databaseFiles.iterator(); - while (iterator.hasNext()) { - Path databasePath = iterator.next(); - if (Files.isRegularFile(databasePath) && pathMatcher.matches(databasePath)) { - try (InputStream inputStream = Files.newInputStream(databasePath, StandardOpenOption.READ)) { - databaseReaders.put(databasePath.getFileName().toString(), new DatabaseReader.Builder(inputStream).build()); - } - } - } - this.databaseReaders = Collections.unmodifiableMap(databaseReaders); - } catch (IOException e) { - throw new RuntimeException(e); - } + public Factory(Map<String, DatabaseReader> databaseReaders) { + this.databaseReaders = databaseReaders; } public GeoIpProcessor create(Map<String, Object> config) throws Exception { diff --git a/plugins/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java b/plugins/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java index 4b6a60902ea94..6fdb870334296 100644 --- a/plugins/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java +++ b/plugins/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java @@ -19,9 +19,22 @@ package org.elasticsearch.ingest.geoip; +import com.maxmind.geoip2.DatabaseReader; import org.elasticsearch.node.NodeModule; import org.elasticsearch.plugins.Plugin; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.PathMatcher; +import java.nio.file.StandardOpenOption; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.stream.Stream; + public class IngestGeoIpPlugin extends Plugin { @Override @@ -34,7 +47,31 @@ public String description() { return "Plugin that allows to plug in ingest processors"; } - public void onModule(NodeModule nodeModule) { - nodeModule.registerProcessor(GeoIpProcessor.TYPE, (environment, templateService) -> new GeoIpProcessor.Factory(environment.configFile())); + public void onModule(NodeModule nodeModule) throws IOException { + Path geoIpConfigDirectory = nodeModule.getNode().getEnvironment().configFile().resolve("ingest-geoip"); + Map<String, DatabaseReader> databaseReaders = loadDatabaseReaders(geoIpConfigDirectory); + nodeModule.registerProcessor(GeoIpProcessor.TYPE, (environment, templateService) -> new GeoIpProcessor.Factory(databaseReaders)); + } + + static Map<String, DatabaseReader> loadDatabaseReaders(Path geoIpConfigDirectory) throws IOException { + if (Files.exists(geoIpConfigDirectory) == false && Files.isDirectory(geoIpConfigDirectory)) { + throw new IllegalStateException("the geoip directory [" + geoIpConfigDirectory + "] containing databases doesn't exist"); + } + + Map<String, DatabaseReader> databaseReaders = new HashMap<>(); + try (Stream<Path> databaseFiles = Files.list(geoIpConfigDirectory)) { + PathMatcher pathMatcher = geoIpConfigDirectory.getFileSystem().getPathMatcher("glob:**.mmdb"); + // Use iterator instead of forEach otherwise IOException needs to be caught twice... + Iterator<Path> iterator = databaseFiles.iterator(); + while (iterator.hasNext()) { + Path databasePath = iterator.next(); + if (Files.isRegularFile(databasePath) && pathMatcher.matches(databasePath)) { + try (InputStream inputStream = Files.newInputStream(databasePath, StandardOpenOption.READ)) { + databaseReaders.put(databasePath.getFileName().toString(), new DatabaseReader.Builder(inputStream).build()); + } + } + } + } + return Collections.unmodifiableMap(databaseReaders); } } diff --git a/plugins/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpProcessorFactoryTests.java b/plugins/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpProcessorFactoryTests.java index 78dd86d4fdc8c..20ffe7fe43a90 100644 --- a/plugins/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpProcessorFactoryTests.java +++ b/plugins/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpProcessorFactoryTests.java @@ -19,11 +19,13 @@ package org.elasticsearch.ingest.geoip; +import com.maxmind.geoip2.DatabaseReader; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.StreamsUtils; -import org.junit.Before; +import org.junit.BeforeClass; import java.io.ByteArrayInputStream; +import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -40,19 +42,20 @@ public class GeoIpProcessorFactoryTests extends ESTestCase { - private Path configDir; + private static Map<String, DatabaseReader> databaseReaders; - @Before - public void prepareConfigDirectory() throws Exception { - this.configDir = createTempDir(); + @BeforeClass + public static void loadDatabaseReaders() throws IOException { + Path configDir = createTempDir(); Path geoIpConfigDir = configDir.resolve("ingest-geoip"); Files.createDirectories(geoIpConfigDir); Files.copy(new ByteArrayInputStream(StreamsUtils.copyToBytesFromClasspath("/GeoLite2-City.mmdb")), geoIpConfigDir.resolve("GeoLite2-City.mmdb")); Files.copy(new ByteArrayInputStream(StreamsUtils.copyToBytesFromClasspath("/GeoLite2-Country.mmdb")), geoIpConfigDir.resolve("GeoLite2-Country.mmdb")); + databaseReaders = IngestGeoIpPlugin.loadDatabaseReaders(geoIpConfigDir); } - public void testBuild_defaults() throws Exception { - GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(configDir); + public void testBuildDefaults() throws Exception { + GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders); Map<String, Object> config = new HashMap<>(); config.put("source_field", "_field"); @@ -64,8 +67,8 @@ public void testBuild_defaults() throws Exception { assertThat(processor.getFields(), sameInstance(GeoIpProcessor.Factory.DEFAULT_FIELDS)); } - public void testBuild_targetField() throws Exception { - GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(configDir); + public void testBuildTargetField() throws Exception { + GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders); Map<String, Object> config = new HashMap<>(); config.put("source_field", "_field"); config.put("target_field", "_field"); @@ -74,8 +77,8 @@ public void testBuild_targetField() throws Exception { assertThat(processor.getTargetField(), equalTo("_field")); } - public void testBuild_dbFile() throws Exception { - GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(configDir); + public void testBuildDbFile() throws Exception { + GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders); Map<String, Object> config = new HashMap<>(); config.put("source_field", "_field"); config.put("database_file", "GeoLite2-Country.mmdb"); @@ -85,8 +88,8 @@ public void testBuild_dbFile() throws Exception { assertThat(processor.getDbReader().getMetadata().getDatabaseType(), equalTo("GeoLite2-Country")); } - public void testBuild_nonExistingDbFile() throws Exception { - GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(configDir); + public void testBuildNonExistingDbFile() throws Exception { + GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders); Map<String, Object> config = new HashMap<>(); config.put("source_field", "_field"); @@ -99,8 +102,8 @@ public void testBuild_nonExistingDbFile() throws Exception { } } - public void testBuild_fields() throws Exception { - GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(configDir); + public void testBuildFields() throws Exception { + GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders); Set<GeoIpProcessor.Field> fields = EnumSet.noneOf(GeoIpProcessor.Field.class); List<String> fieldNames = new ArrayList<>(); @@ -118,8 +121,8 @@ public void testBuild_fields() throws Exception { assertThat(processor.getFields(), equalTo(fields)); } - public void testBuild_illegalFieldOption() throws Exception { - GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(configDir); + public void testBuildIllegalFieldOption() throws Exception { + GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders); Map<String, Object> config = new HashMap<>(); config.put("source_field", "_field");
b2b7e6996be0cea4d872be637c4fc100971d926e
kotlin
Decompiler: Introduce DeserializerForDecompiler--Component which can "resolve" descriptors without project-It builds dummy descriptors for dependencies which are enough to build decompiled text-
a
https://github.com/JetBrains/kotlin
diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ClassId.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ClassId.java index 88eac1346c08f..c0efac5d2cd3d 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ClassId.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ClassId.java @@ -22,6 +22,12 @@ import org.jetbrains.jet.lang.resolve.name.Name; public final class ClassId { + + @NotNull + public static ClassId topLevel(@NotNull FqName topLevelFqName) { + return new ClassId(topLevelFqName.parent(), FqNameUnsafe.topLevel(topLevelFqName.shortName())); + } + private final FqName packageFqName; private final FqNameUnsafe relativeClassName; @@ -55,6 +61,7 @@ public boolean isTopLevelClass() { return relativeClassName.parent().isRoot(); } + @NotNull public FqNameUnsafe asSingleFqName() { if (packageFqName.isRoot()) return relativeClassName; return new FqNameUnsafe(packageFqName.asString() + "." + relativeClassName.asString()); diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorFinder.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorFinder.java index d56637c306e1c..6ed1cb6e5b09e 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorFinder.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorFinder.java @@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.ReadOnly; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.Name; @@ -43,6 +44,7 @@ public Collection<Name> getClassNames(@NotNull FqName packageName) { @Nullable ClassDescriptor findClass(@NotNull ClassId classId); + @ReadOnly @NotNull Collection<Name> getClassNames(@NotNull FqName packageName); } diff --git a/idea/src/org/jetbrains/jet/plugin/libraries/DeserializerForDecompiler.kt b/idea/src/org/jetbrains/jet/plugin/libraries/DeserializerForDecompiler.kt new file mode 100644 index 0000000000000..44331f5b8c71c --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/libraries/DeserializerForDecompiler.kt @@ -0,0 +1,188 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * 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.jetbrains.jet.plugin.libraries + +import org.jetbrains.jet.descriptors.serialization.ClassId +import org.jetbrains.jet.descriptors.serialization.DescriptorFinder +import org.jetbrains.jet.descriptors.serialization.JavaProtoBufUtil +import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedClassDescriptor +import org.jetbrains.jet.lang.descriptors.* +import org.jetbrains.jet.lang.descriptors.impl.MutablePackageFragmentDescriptor +import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass +import org.jetbrains.jet.lang.resolve.name.FqName +import org.jetbrains.jet.lang.resolve.name.Name +import org.jetbrains.jet.lang.types.ErrorUtils +import org.jetbrains.jet.storage.LockBasedStorageManager +import java.util.Collections +import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils +import com.intellij.openapi.vfs.VirtualFile +import org.jetbrains.jet.lang.resolve.kotlin.KotlinBinaryClassCache +import org.jetbrains.jet.lang.resolve.kotlin.DeserializedResolverUtils +import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedPackageMemberScope +import org.jetbrains.jet.lang.resolve.kotlin.AnnotationDescriptorDeserializer +import org.jetbrains.jet.lang.resolve.java.resolver.ErrorReporter +import org.jetbrains.jet.lang.types.ErrorUtils.getErrorModule +import org.jetbrains.jet.lang.types.error.MissingDependencyErrorClassDescriptor +import org.jetbrains.jet.lang.resolve.java.PackageClassUtils +import com.intellij.openapi.diagnostic.Logger +import org.jetbrains.jet.lang.resolve.kotlin.KotlinClassFinder +import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe + +public fun DeserializerForDecompiler(classFile: VirtualFile): DeserializerForDecompiler { + val kotlinClass = KotlinBinaryClassCache.getKotlinBinaryClass(classFile) + val classFqName = kotlinClass.getClassName().getFqNameForClassNameWithoutDollars() + val packageFqName = classFqName.parent() + return DeserializerForDecompiler(classFile.getParent()!!, packageFqName) +} + +public class DeserializerForDecompiler(val packageDirectory: VirtualFile, val directoryPackageFqName: FqName) : ResolverForDecompiler { + + override fun resolveClass(classFqName: FqName) = classes(classFqName.toClassId()) + + override fun resolveDeclarationsInPackage(packageFqName: FqName): Collection<DeclarationDescriptor> { + assert(packageFqName == directoryPackageFqName, "Was called for $packageFqName but only $directoryPackageFqName is expected.") + val packageClassFqName = PackageClassUtils.getPackageClassFqName(packageFqName) + val binaryClassForPackageClass = localClassFinder.findKotlinClass(packageClassFqName) + val annotationData = binaryClassForPackageClass?.getClassHeader()?.getAnnotationData() + if (annotationData == null) { + LOG.error("Could not read annotation data for $packageFqName from ${binaryClassForPackageClass?.getClassName()}") + return Collections.emptyList() + } + val membersScope = DeserializedPackageMemberScope( + storageManager, + createDummyPackageFragment(packageFqName), + annotationDeserializer, + descriptorFinder, + JavaProtoBufUtil.readPackageDataFrom(annotationData) + ) + return membersScope.getAllDescriptors() + } + + private val localClassFinder = object: KotlinClassFinder { + override fun findKotlinClass(fqName: FqName) = findKotlinClass(fqName.toClassId()) + + fun findKotlinClass(classId: ClassId): KotlinJvmBinaryClass? { + if (classId.getPackageFqName() != directoryPackageFqName) { + return null + } + val segments = DeserializedResolverUtils.kotlinFqNameToJavaFqName(classId.getRelativeClassName()).pathSegments() + val targetName = segments.makeString("$", postfix = ".class") + val virtualFile = packageDirectory.findChild(targetName) + if (virtualFile != null && DecompiledUtils.isKotlinCompiledFile(virtualFile)) { + return KotlinBinaryClassCache.getKotlinBinaryClass(virtualFile) + } + return null + } + } + private val storageManager = LockBasedStorageManager.NO_LOCKS + private val classes = storageManager.createMemoizedFunctionWithNullableValues { + (classId: ClassId) -> + resolveClassByClassId(classId) + } + + private val annotationDeserializer = AnnotationDescriptorDeserializer(storageManager); + { + annotationDeserializer.setClassResolver { + fqName -> + classes(fqName.toClassId()) + } + annotationDeserializer.setKotlinClassFinder(localClassFinder) + annotationDeserializer.setErrorReporter(LOGGING_REPORTER) + } + + private val descriptorFinder = object : DescriptorFinder { + override fun findClass(classId: ClassId): ClassDescriptor? { + return classes(classId) + } + + override fun getClassNames(packageName: FqName): Collection<Name> { + return Collections.emptyList() + } + } + + private val packageFragmentProvider = object : PackageFragmentProvider { + override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> { + return listOf(createDummyPackageFragment(fqName)) + } + + override fun getSubPackagesOf(fqName: FqName): Collection<FqName> { + throw UnsupportedOperationException("This method is not supposed to be called.") + } + } + + private fun createDummyPackageFragment(fqName: FqName): MutablePackageFragmentDescriptor { + return MutablePackageFragmentDescriptor(ErrorUtils.getErrorModule(), fqName) + } + + private fun resolveClassByClassId(classId: ClassId): ClassDescriptor? { + val fullFqName = classId.asSingleFqName() + if (fullFqName.isSafe()) { + val fromBuiltIns = DescriptorResolverUtils.getKotlinBuiltinClassDescriptor(fullFqName.toSafe()) + if (fromBuiltIns != null) { + return fromBuiltIns + } + } + val binaryClass = localClassFinder.findKotlinClass(classId) + if (binaryClass != null) { + return deserializeBinaryClass(binaryClass) + } + assert(fullFqName.isSafe(), "Safe fq name expected here, got $fullFqName instead") + return MissingDependencyErrorClassDescriptor(fullFqName.toSafe()) + } + + private fun deserializeBinaryClass(kotlinClass: KotlinJvmBinaryClass): ClassDescriptor { + val data = kotlinClass.getClassHeader()?.getAnnotationData() + if (data == null) { + LOG.error("Annotation data missing for ${kotlinClass.getClassName()}") + } + val classData = JavaProtoBufUtil.readClassDataFrom(data!!) + return DeserializedClassDescriptor(storageManager, annotationDeserializer, descriptorFinder, packageFragmentProvider, + classData.getNameResolver(), classData.getClassProto()) + } + + // we need a "magic" way to obtain ClassId from FqName + // the idea behind this function is that we need accurate class ids only for "neighbouring" classes (inner classes, class object, etc) + // for all others we can build any ClassId since it will resolve to MissingDependencyErrorClassDescriptor which only stores fqName + private fun FqName.toClassId(): ClassId { + val segments = pathSegments() + val packageSegmentsCount = directoryPackageFqName.pathSegments().size + if (segments.size <= packageSegmentsCount) { + return ClassId.topLevel(this) + } + val packageFqName = FqName.fromSegments(segments.subList(0, packageSegmentsCount) map { it.asString() }) + if (packageFqName == directoryPackageFqName) { + return ClassId(packageFqName, FqNameUnsafe.fromSegments(segments.subList(packageSegmentsCount, segments.size))) + } + return ClassId.topLevel(this) + } + + class object { + private val LOG = Logger.getInstance(javaClass<DeserializerForDecompiler>()) + + private object LOGGING_REPORTER: ErrorReporter { + override fun reportAnnotationLoadingError(message: String, exception: Exception?) { + LOG.error(message, exception) + } + override fun reportCannotInferVisibility(descriptor: CallableMemberDescriptor) { + LOG.error("Could not infer visibility for $descriptor") + } + override fun reportIncompatibleAbiVersion(kotlinClass: KotlinJvmBinaryClass, actualVersion: Int) { + LOG.error("Incompatible ABI version for class ${kotlinClass.getClassName()}, actual version: $actualVersion") + } + } + } +}
1ec0103ac9439f67c4a9dcf9886ea0adf9cfa020
restlet-framework-java
- Fixed filling state bug in Buffer class -- Removed received inbound message from messages queue when fully received -- Connection closing seems to work again - CouchDBUpload test working again--
c
https://github.com/restlet/restlet-framework-java
diff --git a/modules/org.restlet/src/org/restlet/engine/connector/HttpClientInboundWay.java b/modules/org.restlet/src/org/restlet/engine/connector/HttpClientInboundWay.java index 21907de577..8c6594124d 100644 --- a/modules/org.restlet/src/org/restlet/engine/connector/HttpClientInboundWay.java +++ b/modules/org.restlet/src/org/restlet/engine/connector/HttpClientInboundWay.java @@ -114,6 +114,15 @@ public void onError(Status status) { super.onError(status); } + @Override + public void onCompleted(boolean endDetected) { + if (getMessage() != null) { + getMessages().remove(getMessage()); + } + + super.onCompleted(endDetected); + } + @Override public void updateState() { if (getIoState() == IoState.IDLE) { diff --git a/modules/org.restlet/src/org/restlet/engine/connector/InboundWay.java b/modules/org.restlet/src/org/restlet/engine/connector/InboundWay.java index 0756edfdde..86a7b6de49 100644 --- a/modules/org.restlet/src/org/restlet/engine/connector/InboundWay.java +++ b/modules/org.restlet/src/org/restlet/engine/connector/InboundWay.java @@ -322,7 +322,7 @@ public int processIoBuffer() throws IOException { } else { result = super.processIoBuffer(); } - + return result; } diff --git a/modules/org.restlet/src/org/restlet/engine/connector/Way.java b/modules/org.restlet/src/org/restlet/engine/connector/Way.java index 56fcc37c68..3655721368 100644 --- a/modules/org.restlet/src/org/restlet/engine/connector/Way.java +++ b/modules/org.restlet/src/org/restlet/engine/connector/Way.java @@ -376,8 +376,10 @@ public void onSelected() { setIoState(IoState.CANCELLED); } - getLogger().log(Level.FINE, - "Way selected. Processing IO for : " + this); + if (getLogger().isLoggable(Level.FINER)) { + getLogger().log(Level.FINER, + "Way selected. Processing IO for : " + this); + } // IO processing int drained = processIoBuffer(); diff --git a/modules/org.restlet/src/org/restlet/engine/io/Buffer.java b/modules/org.restlet/src/org/restlet/engine/io/Buffer.java index 764b529c55..89a6b14e4a 100644 --- a/modules/org.restlet/src/org/restlet/engine/io/Buffer.java +++ b/modules/org.restlet/src/org/restlet/engine/io/Buffer.java @@ -464,6 +464,7 @@ public int process(BufferProcessor processor, Object... args) int filled = 0; boolean lastDrainFailed = false; boolean lastFillFailed = false; + boolean fillEnded = false; while (tryAgain && processor.canLoop()) { if (isDraining()) { @@ -484,18 +485,15 @@ public int process(BufferProcessor processor, Object... args) Context.getCurrentLogger().finer( drained + " bytes drained from buffer"); } - } else if (drained == -1) { - if (result == 0) { - result = -1; + } else { + if (!lastFillFailed && couldFill()) { + // We may still be able to fill + beforeFill(); + } else { + tryAgain = false; } - tryAgain = false; - } else if (!lastFillFailed && couldFill()) { - // We may still be able to fill lastDrainFailed = true; - beforeFill(); - } else { - tryAgain = false; } } else if (isFilling()) { filled = 0; @@ -515,18 +513,16 @@ public int process(BufferProcessor processor, Object... args) Context.getCurrentLogger().finer( filled + " bytes filled into buffer"); } - } else if (filled == -1) { - if (result == 0) { - result = -1; + } else { + if (!lastDrainFailed && couldDrain()) { + // We may still be able to drain + beforeDrain(); + } else { + tryAgain = false; } - tryAgain = false; - } else if (!lastDrainFailed && couldDrain()) { - // We may still be able to drain + fillEnded = (filled == -1); lastFillFailed = true; - beforeDrain(); - } else { - tryAgain = false; } } else { // Can't drain nor fill @@ -534,7 +530,7 @@ public int process(BufferProcessor processor, Object... args) } } - if ((result == 0) && !processor.couldFill()) { + if ((result == 0) && (!processor.couldFill() || fillEnded)) { // Nothing was drained and no hope to fill again result = -1; } diff --git a/modules/org.restlet/src/org/restlet/engine/io/ReadableChunkedChannel.java b/modules/org.restlet/src/org/restlet/engine/io/ReadableChunkedChannel.java index ed78d94097..966c87a757 100644 --- a/modules/org.restlet/src/org/restlet/engine/io/ReadableChunkedChannel.java +++ b/modules/org.restlet/src/org/restlet/engine/io/ReadableChunkedChannel.java @@ -264,8 +264,8 @@ public int read(ByteBuffer dst) throws IOException { } if ((result == -1) - && (getWrappedChannel() instanceof ReadableBufferedChannel)) { - ((ReadableBufferedChannel) getWrappedChannel()).onCompleted(false); + && (getWrappedChannel() instanceof CompletionListener)) { + ((CompletionListener) getWrappedChannel()).onCompleted(false); } return result; diff --git a/modules/org.restlet/src/org/restlet/engine/io/ReadableSizedChannel.java b/modules/org.restlet/src/org/restlet/engine/io/ReadableSizedChannel.java index 7441a25fe3..01070568fb 100644 --- a/modules/org.restlet/src/org/restlet/engine/io/ReadableSizedChannel.java +++ b/modules/org.restlet/src/org/restlet/engine/io/ReadableSizedChannel.java @@ -100,8 +100,8 @@ public int read(ByteBuffer dst) throws IOException { } if ((result == -1) - && (getWrappedChannel() instanceof ReadableBufferedChannel)) { - ((ReadableBufferedChannel) getWrappedChannel()) + && (getWrappedChannel() instanceof CompletionListener)) { + ((CompletionListener) getWrappedChannel()) .onCompleted((wrappedRead == -1)); }
05d93592ba53123c2483b146d9aab9cc6e112ae1
drools
[DROOLS-37] fix jitting of comparison contraints- (cherry picked from commit 5ea47c020451949cc52708494afdfa50799467a2)--
c
https://github.com/kiegroup/drools
diff --git a/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest2.java b/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest2.java index f6970516ae7..bc98ca4be75 100644 --- a/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest2.java +++ b/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest2.java @@ -1129,4 +1129,48 @@ public void setPrice(BigDecimal price) { this.price = price; } } + + @Test + public void testJitComparable() { + // DROOLS-37 + String str = + "import org.drools.integrationtests.MiscTest2.IntegerWrapperImpl;\n" + + "\n" + + "rule \"minCost\"\n" + + "when\n" + + " $a : IntegerWrapperImpl()\n" + + " IntegerWrapperImpl( this < $a )\n" + + "then\n" + + "end"; + + KnowledgeBase kbase = loadKnowledgeBaseFromString(str); + StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); + ksession.insert(new IntegerWrapperImpl(2)); + ksession.insert(new IntegerWrapperImpl(3)); + + assertEquals(1, ksession.fireAllRules()); + } + + interface IntegerWraper { + int getInt(); + } + + public static abstract class AbstractIntegerWrapper implements IntegerWraper, Comparable<IntegerWraper> { } + + public static class IntegerWrapperImpl extends AbstractIntegerWrapper { + + private final int i; + + public IntegerWrapperImpl(int i) { + this.i = i; + } + + public int compareTo(IntegerWraper o) { + return getInt() - o.getInt(); + } + + public int getInt() { + return i; + } + } } \ No newline at end of file diff --git a/drools-core/src/main/java/org/drools/rule/constraint/ASMConditionEvaluatorJitter.java b/drools-core/src/main/java/org/drools/rule/constraint/ASMConditionEvaluatorJitter.java index dbc4f496661..5fd86b7e117 100644 --- a/drools-core/src/main/java/org/drools/rule/constraint/ASMConditionEvaluatorJitter.java +++ b/drools-core/src/main/java/org/drools/rule/constraint/ASMConditionEvaluatorJitter.java @@ -15,6 +15,8 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Iterator; @@ -351,9 +353,9 @@ private void jitObjectBinary(SingleCondition singleCondition, Expression left, E } } else { if (type.isInterface()) { - invokeInterface(type, "compareTo", int.class, type == Comparable.class ? Object.class : type); + invokeInterface(type, "compareTo", int.class, type == Comparable.class ? Object.class : findComparingClass(type)); } else { - invokeVirtual(type, "compareTo", int.class, type); + invokeVirtual(type, "compareTo", int.class, findComparingClass(type)); } mv.visitInsn(ICONST_0); jitPrimitiveOperation(operation == BooleanOperator.NE ? BooleanOperator.EQ : operation, int.class); @@ -366,6 +368,25 @@ private void jitObjectBinary(SingleCondition singleCondition, Expression left, E mv.visitLabel(shortcutEvaluation); } + private Class<?> findComparingClass(Class<?> type) { + return findComparingClass(type, type); + } + + private Class<?> findComparingClass(Class<?> type, Class<?> originalType) { + if (type == null) { + return originalType; + } + for (Type interfaze : type.getGenericInterfaces()) { + if (interfaze instanceof ParameterizedType) { + ParameterizedType pType = (ParameterizedType)interfaze; + if (pType.getRawType() == Comparable.class) { + return (Class<?>) pType.getActualTypeArguments()[0]; + } + } + } + return findComparingClass(type.getSuperclass(), originalType); + } + private void prepareLeftOperand(BooleanOperator operation, Class<?> type, Class<?> leftType, Class<?> rightType, Label shortcutEvaluation) { if (leftType.isPrimitive()) { if (type != null) {
4405698ee99fe26d0ac9317a2df96096f2731a7b
hbase
HBASE-7703 Eventually all online snapshots fail- due to Timeout at same regionserver.--Online snapshot attempts would fail due to timeout because a rowlock could not be obtained. Prior to this a-cancellation occurred which likely grabbed the lock without cleaning it properly. The fix here is to use nice cancel-instead of interrupting cancel on failures.----git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-7290@1445866 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/hbase
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/snapshot/RegionServerSnapshotManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/snapshot/RegionServerSnapshotManager.java index 3e5238e7b281..1282585d52eb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/snapshot/RegionServerSnapshotManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/snapshot/RegionServerSnapshotManager.java @@ -347,7 +347,11 @@ void cancelTasks() throws InterruptedException { Collection<Future<Void>> tasks = futures; LOG.debug("cancelling " + tasks.size() + " tasks for snapshot " + name); for (Future<Void> f: tasks) { - f.cancel(true); + // TODO Ideally we'd interrupt hbase threads when we cancel. However it seems that there + // are places in the HBase code where row/region locks are taken and not released in a + // finally block. Thus we cancel without interrupting. Cancellations will be slower to + // complete but we won't suffer from unreleased locks due to poor code discipline. + f.cancel(false); } // evict remaining tasks and futures from taskPool.
4634ca5cb8c8ad0a3c725363f3705a4078c04c9c
elasticsearch
Mapping: When _all is disabled, optimize to not- gather all entries, closes -722.--
p
https://github.com/elastic/elasticsearch
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/AllFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/AllFieldMapper.java index 3eafa63f880ef..79a3b4a43b6df 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/AllFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/AllFieldMapper.java @@ -25,4 +25,9 @@ public interface AllFieldMapper extends FieldMapper<Void>, InternalMapper { public static final String NAME = "_all"; + + /** + * Is the all field enabled or not. + */ + public boolean enabled(); } \ No newline at end of file diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ByteFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ByteFieldMapper.java index 1bde6b18de857..e890ff6c13104 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ByteFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ByteFieldMapper.java @@ -160,7 +160,7 @@ protected ByteFieldMapper(Names names, int precisionStep, Field.Index index, Fie } else { value = ((Number) externalValue).byteValue(); } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), Byte.toString(value), boost); } } else { @@ -169,12 +169,12 @@ protected ByteFieldMapper(Names names, int precisionStep, Field.Index index, Fie return null; } value = nullValue; - if (nullValueAsString != null && (includeInAll == null || includeInAll)) { + if (nullValueAsString != null && (context.includeInAll(includeInAll))) { context.allEntries().addText(names.fullName(), nullValueAsString, boost); } } else { value = (byte) context.parser().shortValue(); - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), context.parser().text(), boost); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/DateFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/DateFieldMapper.java index 3ab03f09b0d0f..92b30ac51bf1b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/DateFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/DateFieldMapper.java @@ -194,7 +194,7 @@ protected DateFieldMapper(Names names, FormatDateTimeFormatter dateTimeFormatter if (dateAsString == null) { return null; } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), dateAsString, boost); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/DoubleFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/DoubleFieldMapper.java index 406a49ebb3468..8fa0484fe45f3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/DoubleFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/DoubleFieldMapper.java @@ -162,7 +162,7 @@ protected DoubleFieldMapper(Names names, int precisionStep, } else { value = ((Number) externalValue).doubleValue(); } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), Double.toString(value), boost); } } else { @@ -171,12 +171,12 @@ protected DoubleFieldMapper(Names names, int precisionStep, return null; } value = nullValue; - if (nullValueAsString != null && (includeInAll == null || includeInAll)) { + if (nullValueAsString != null && (context.includeInAll(includeInAll))) { context.allEntries().addText(names.fullName(), nullValueAsString, boost); } } else { value = context.parser().doubleValue(); - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), context.parser().text(), boost); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/FloatFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/FloatFieldMapper.java index 2553e11110f63..c4e859d146ade 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/FloatFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/FloatFieldMapper.java @@ -161,7 +161,7 @@ protected FloatFieldMapper(Names names, int precisionStep, Field.Index index, Fi } else { value = ((Number) externalValue).floatValue(); } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), Float.toString(value), boost); } } else { @@ -170,12 +170,12 @@ protected FloatFieldMapper(Names names, int precisionStep, Field.Index index, Fi return null; } value = nullValue; - if (nullValueAsString != null && (includeInAll == null || includeInAll)) { + if (nullValueAsString != null && (context.includeInAll(includeInAll))) { context.allEntries().addText(names.fullName(), nullValueAsString, boost); } } else { value = context.parser().floatValue(); - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), context.parser().text(), boost); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/IntegerFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/IntegerFieldMapper.java index 292adcd425048..40d77a15430e6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/IntegerFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/IntegerFieldMapper.java @@ -161,7 +161,7 @@ protected IntegerFieldMapper(Names names, int precisionStep, Field.Index index, } else { value = ((Number) externalValue).intValue(); } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), Integer.toString(value), boost); } } else { @@ -170,12 +170,12 @@ protected IntegerFieldMapper(Names names, int precisionStep, Field.Index index, return null; } value = nullValue; - if (nullValueAsString != null && (includeInAll == null || includeInAll)) { + if (nullValueAsString != null && (context.includeInAll(includeInAll))) { context.allEntries().addText(names.fullName(), nullValueAsString, boost); } } else { value = context.parser().intValue(); - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), context.parser().text(), boost); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/LongFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/LongFieldMapper.java index 08f6512ff37f6..9498cd5ca2351 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/LongFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/LongFieldMapper.java @@ -161,7 +161,7 @@ protected LongFieldMapper(Names names, int precisionStep, Field.Index index, Fie } else { value = ((Number) externalValue).longValue(); } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), Long.toString(value), boost); } } else { @@ -170,12 +170,12 @@ protected LongFieldMapper(Names names, int precisionStep, Field.Index index, Fie return null; } value = nullValue; - if (nullValueAsString != null && (includeInAll == null || includeInAll)) { + if (nullValueAsString != null && (context.includeInAll(includeInAll))) { context.allEntries().addText(names.fullName(), nullValueAsString, boost); } } else { value = context.parser().longValue(); - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), context.parser().text(), boost); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ParseContext.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ParseContext.java index 31c998915f0e6..668e56394bb91 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ParseContext.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ParseContext.java @@ -199,6 +199,18 @@ public void uid(String uid) { this.uid = uid; } + /** + * Is all included or not. Will always disable it if {@link org.elasticsearch.index.mapper.AllFieldMapper#enabled()} + * is <tt>false</tt>. If its enabled, then will return <tt>true</tt> only if the specific flag is <tt>null</tt> or + * its actual value (so, if not set, defaults to "true"). + */ + public boolean includeInAll(Boolean specificIncludeInAll) { + if (!docMapper.allFieldMapper().enabled()) { + return false; + } + return specificIncludeInAll == null || specificIncludeInAll; + } + public AllEntries allEntries() { return this.allEntries; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ShortFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ShortFieldMapper.java index e82db319d9642..a685a18f6718c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ShortFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ShortFieldMapper.java @@ -161,7 +161,7 @@ protected ShortFieldMapper(Names names, int precisionStep, Field.Index index, Fi } else { value = ((Number) externalValue).shortValue(); } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), Short.toString(value), boost); } } else { @@ -170,12 +170,12 @@ protected ShortFieldMapper(Names names, int precisionStep, Field.Index index, Fi return null; } value = nullValue; - if (nullValueAsString != null && (includeInAll == null || includeInAll)) { + if (nullValueAsString != null && (context.includeInAll(includeInAll))) { context.allEntries().addText(names.fullName(), nullValueAsString, boost); } } else { value = context.parser().shortValue(); - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), context.parser().text(), boost); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/StringFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/StringFieldMapper.java index fa9831ecf6d11..36b31b05102de 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/StringFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/StringFieldMapper.java @@ -140,7 +140,7 @@ protected StringFieldMapper(Names names, Field.Index index, Field.Store store, F if (value == null) { return null; } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), value, boost); } if (!indexed() && !stored()) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ip/IpFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ip/IpFieldMapper.java index 112f0e405f20f..0b9cb391b314e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ip/IpFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ip/IpFieldMapper.java @@ -210,7 +210,7 @@ protected IpFieldMapper(Names names, int precisionStep, if (ipAsString == null) { return null; } - if (includeInAll == null || includeInAll) { + if (context.includeInAll(includeInAll)) { context.allEntries().addText(names.fullName(), ipAsString, boost); }
b40e657180d21655dc6d1ceed6c7726fe7c78071
kotlin
Create from usage: Create constructor parameter- by reference in delegation specifier -KT-6601 Fixed--
a
https://github.com/JetBrains/kotlin
diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createVariable/CreateParameterActionFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createVariable/CreateParameterActionFactory.kt index 03f976e86a38a..471c74f00035a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createVariable/CreateParameterActionFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createVariable/CreateParameterActionFactory.kt @@ -50,6 +50,8 @@ import org.jetbrains.kotlin.psi.psiUtil.getAssignmentByLHS import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.getExpressionForTypeGuess import org.jetbrains.kotlin.idea.caches.resolve.analyzeFullyAndGetResult import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull +import org.jetbrains.kotlin.psi.JetDelegationSpecifier +import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType object CreateParameterActionFactory: JetSingleIntentionActionFactory() { override fun createAction(diagnostic: Diagnostic): IntentionAction? { @@ -78,13 +80,20 @@ object CreateParameterActionFactory: JetSingleIntentionActionFactory() { // todo: skip lambdas for now because Change Signature doesn't apply to them yet val container = refExpr.parents(false) - .filter { it is JetNamedFunction || it is JetPropertyAccessor || it is JetClassBody || it is JetClassInitializer } + .filter { + it is JetNamedFunction || it is JetPropertyAccessor || it is JetClassBody || it is JetClassInitializer || + it is JetDelegationSpecifier + } .firstOrNull() ?.let { when { it is JetNamedFunction && varExpected, it is JetPropertyAccessor -> chooseContainingClass(it) it is JetClassInitializer -> it.getParent()?.getParent() as? JetClass + it is JetDelegationSpecifier -> { + val klass = it.getStrictParentOfType<JetClass>() + if (klass != null && !klass.isTrait() && klass !is JetEnumEntry) klass else null + } it is JetClassBody -> { val klass = it.getParent() as? JetClass when { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterParameterFromClassDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterParameterFromClassDelegationSpecifier.kt new file mode 100644 index 0000000000000..a5d9c99160b84 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterParameterFromClassDelegationSpecifier.kt @@ -0,0 +1,9 @@ +// "Create parameter 'b'" "true" + +open class A(val a: Int) { + +} + +class B(b: Int) : A(b) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromClassDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromClassDelegationSpecifier.kt new file mode 100644 index 0000000000000..5cd39985fc62b --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromClassDelegationSpecifier.kt @@ -0,0 +1,9 @@ +// "Create parameter 'b'" "true" + +open class A(val a: Int) { + +} + +class B: A(<caret>b) { + +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromEnumEntryDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromEnumEntryDelegationSpecifier.kt new file mode 100644 index 0000000000000..36abff1bfd5e8 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromEnumEntryDelegationSpecifier.kt @@ -0,0 +1,7 @@ +// "Create parameter 'x'" "false" +// ERROR: Unresolved reference: x +// ACTION: Create property 'x' + +enum class E(n: Int) { + X: E(<caret>x) +} \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromObjectDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromObjectDelegationSpecifier.kt new file mode 100644 index 0000000000000..12a7e5e340aac --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromObjectDelegationSpecifier.kt @@ -0,0 +1,11 @@ +// "Create parameter 'b'" "false" +// ERROR: Unresolved reference: b +// ACTION: Create property 'b' + +open class A(val a: Int) { + +} + +object B: A(<caret>b) { + +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index ec87dab8b44e6..ef74610d1e872 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -2417,6 +2417,24 @@ public void testNullableType() throws Exception { doTest(fileName); } + @TestMetadata("beforeParameterFromClassDelegationSpecifier.kt") + public void testParameterFromClassDelegationSpecifier() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromClassDelegationSpecifier.kt"); + doTest(fileName); + } + + @TestMetadata("beforeParameterFromEnumEntryDelegationSpecifier.kt") + public void testParameterFromEnumEntryDelegationSpecifier() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromEnumEntryDelegationSpecifier.kt"); + doTest(fileName); + } + + @TestMetadata("beforeParameterFromObjectDelegationSpecifier.kt") + public void testParameterFromObjectDelegationSpecifier() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromObjectDelegationSpecifier.kt"); + doTest(fileName); + } + @TestMetadata("beforeQualifiedInFun.kt") public void testQualifiedInFun() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeQualifiedInFun.kt");
03687b80bcd2c8f8968a044f4f9b8c865af0fd61
hbase
HBASE-11813 CellScanner-advance may overflow- stack--
c
https://github.com/apache/hbase
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java index 8dce6ba3200f..50e42c65633b 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java @@ -201,13 +201,14 @@ public Cell current() { @Override public boolean advance() throws IOException { - if (this.cellScanner == null) { - if (!this.iterator.hasNext()) return false; - this.cellScanner = this.iterator.next().cellScanner(); + while (true) { + if (this.cellScanner == null) { + if (!this.iterator.hasNext()) return false; + this.cellScanner = this.iterator.next().cellScanner(); + } + if (this.cellScanner.advance()) return true; + this.cellScanner = null; } - if (this.cellScanner.advance()) return true; - this.cellScanner = null; - return advance(); } }; } @@ -275,11 +276,9 @@ public boolean advance() { * inside Put, etc., keeping Cells organized by family. * @return CellScanner interface over <code>cellIterable</code> */ - public static CellScanner createCellScanner(final NavigableMap<byte [], - List<Cell>> map) { + public static CellScanner createCellScanner(final NavigableMap<byte [], List<Cell>> map) { return new CellScanner() { - private final Iterator<Entry<byte[], List<Cell>>> entries = - map.entrySet().iterator(); + private final Iterator<Entry<byte[], List<Cell>>> entries = map.entrySet().iterator(); private Iterator<Cell> currentIterator = null; private Cell currentCell; @@ -290,17 +289,18 @@ public Cell current() { @Override public boolean advance() { - if (this.currentIterator == null) { - if (!this.entries.hasNext()) return false; - this.currentIterator = this.entries.next().getValue().iterator(); + while(true) { + if (this.currentIterator == null) { + if (!this.entries.hasNext()) return false; + this.currentIterator = this.entries.next().getValue().iterator(); + } + if (this.currentIterator.hasNext()) { + this.currentCell = this.currentIterator.next(); + return true; + } + this.currentCell = null; + this.currentIterator = null; } - if (this.currentIterator.hasNext()) { - this.currentCell = this.currentIterator.next(); - return true; - } - this.currentCell = null; - this.currentIterator = null; - return advance(); } }; } diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java index 4835ccab8719..50063f4da64a 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java @@ -18,6 +18,12 @@ package org.apache.hadoop.hbase; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.NavigableMap; +import java.util.TreeMap; + import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert; import org.junit.Test; @@ -25,6 +31,250 @@ @Category(SmallTests.class) public class TestCellUtil { + /** + * CellScannable used in test. Returns a {@link TestCellScanner} + */ + private class TestCellScannable implements CellScannable { + private final int cellsCount; + TestCellScannable(final int cellsCount) { + this.cellsCount = cellsCount; + } + @Override + public CellScanner cellScanner() { + return new TestCellScanner(this.cellsCount); + } + }; + + /** + * CellScanner used in test. + */ + private class TestCellScanner implements CellScanner { + private int count = 0; + private Cell current = null; + private final int cellsCount; + + TestCellScanner(final int cellsCount) { + this.cellsCount = cellsCount; + } + + @Override + public Cell current() { + return this.current; + } + + @Override + public boolean advance() throws IOException { + if (this.count < cellsCount) { + this.current = new TestCell(this.count); + this.count++; + return true; + } + return false; + } + } + + /** + * Cell used in test. Has row only. + */ + private class TestCell implements Cell { + private final byte [] row; + + TestCell(final int i) { + this.row = Bytes.toBytes(i); + } + + @Override + public byte[] getRowArray() { + return this.row; + } + + @Override + public int getRowOffset() { + return 0; + } + + @Override + public short getRowLength() { + return (short)this.row.length; + } + + @Override + public byte[] getFamilyArray() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getFamilyOffset() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte getFamilyLength() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte[] getQualifierArray() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getQualifierOffset() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getQualifierLength() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getTimestamp() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte getTypeByte() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getMvccVersion() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte[] getValueArray() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getValueOffset() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getValueLength() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte[] getTagsArray() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getTagsOffset() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public byte[] getValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public byte[] getFamily() { + // TODO Auto-generated method stub + return null; + } + + @Override + public byte[] getQualifier() { + // TODO Auto-generated method stub + return null; + } + + @Override + public byte[] getRow() { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getSequenceId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getTagsLength() { + // TODO Auto-generated method stub + return 0; + } + }; + + /** + * Was overflowing if 100k or so lists of cellscanners to return. + * @throws IOException + */ + @Test + public void testCreateCellScannerOverflow() throws IOException { + consume(doCreateCellScanner(1, 1), 1 * 1); + consume(doCreateCellScanner(3, 0), 3 * 0); + consume(doCreateCellScanner(3, 3), 3 * 3); + consume(doCreateCellScanner(0, 1), 0 * 1); + // Do big number. See HBASE-11813 for why. + final int hundredK = 100000; + consume(doCreateCellScanner(hundredK, 0), hundredK * 0); + consume(doCreateCellArray(1), 1); + consume(doCreateCellArray(0), 0); + consume(doCreateCellArray(3), 3); + List<CellScannable> cells = new ArrayList<CellScannable>(hundredK); + for (int i = 0; i < hundredK; i++) { + cells.add(new TestCellScannable(1)); + } + consume(CellUtil.createCellScanner(cells), hundredK * 1); + NavigableMap<byte [], List<Cell>> m = new TreeMap<byte [], List<Cell>>(Bytes.BYTES_COMPARATOR); + List<Cell> cellArray = new ArrayList<Cell>(hundredK); + for (int i = 0; i < hundredK; i++) cellArray.add(new TestCell(i)); + m.put(new byte [] {'f'}, cellArray); + consume(CellUtil.createCellScanner(m), hundredK * 1); + } + + private CellScanner doCreateCellArray(final int itemsPerList) { + Cell [] cells = new Cell [itemsPerList]; + for (int i = 0; i < itemsPerList; i++) { + cells[i] = new TestCell(i); + } + return CellUtil.createCellScanner(cells); + } + + private CellScanner doCreateCellScanner(final int listsCount, final int itemsPerList) + throws IOException { + List<CellScannable> cells = new ArrayList<CellScannable>(listsCount); + for (int i = 0; i < listsCount; i++) { + CellScannable cs = new CellScannable() { + @Override + public CellScanner cellScanner() { + return new TestCellScanner(itemsPerList); + } + }; + cells.add(cs); + } + return CellUtil.createCellScanner(cells); + } + + private void consume(final CellScanner scanner, final int expected) throws IOException { + int count = 0; + while (scanner.advance()) count++; + Assert.assertEquals(expected, count); + } @Test public void testOverlappingKeys() { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java index c36478621f46..05fd873e7b9e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java @@ -139,7 +139,7 @@ public void run() { RpcServer.LOG.warn(Thread.currentThread().getName() + ": caught: " + StringUtils.stringifyException(e)); } finally { - // regardless if succesful or not we need to reset the callQueueSize + // regardless if successful or not we need to reset the callQueueSize this.rpcServer.addCallSize(call.getSize() * -1); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java index 2debe2ec8d7a..5b13b1d70542 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java @@ -126,21 +126,21 @@ public SimpleRpcScheduler( // multiple read/write queues if (callQueueType.equals(CALL_QUEUE_TYPE_DEADLINE_CONF_VALUE)) { CallPriorityComparator callPriority = new CallPriorityComparator(conf, this.priority); - callExecutor = new RWQueueRpcExecutor("default", handlerCount, numCallQueues, + callExecutor = new RWQueueRpcExecutor("RW.default", handlerCount, numCallQueues, callqReadShare, callqScanShare, maxQueueLength, BoundedPriorityBlockingQueue.class, callPriority); } else { - callExecutor = new RWQueueRpcExecutor("default", handlerCount, numCallQueues, + callExecutor = new RWQueueRpcExecutor("RW.default", handlerCount, numCallQueues, callqReadShare, callqScanShare, maxQueueLength); } } else { // multiple queues if (callQueueType.equals(CALL_QUEUE_TYPE_DEADLINE_CONF_VALUE)) { CallPriorityComparator callPriority = new CallPriorityComparator(conf, this.priority); - callExecutor = new BalancedQueueRpcExecutor("default", handlerCount, numCallQueues, + callExecutor = new BalancedQueueRpcExecutor("B.default", handlerCount, numCallQueues, BoundedPriorityBlockingQueue.class, maxQueueLength, callPriority); } else { - callExecutor = new BalancedQueueRpcExecutor("default", handlerCount, + callExecutor = new BalancedQueueRpcExecutor("B.default", handlerCount, numCallQueues, maxQueueLength); } }
a2cdf208dd53a77eeb2a87ffe9a71fd19d8fd164
hadoop
YARN-1757. NM Recovery. Auxiliary service support.- (Jason Lowe via kasha)--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1585784 13f79535-47bb-0310-9956-ffa450edef68-
a
https://github.com/apache/hadoop
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 835500278cbd3..7589cfc4a2d8d 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -6,6 +6,8 @@ Release 2.5.0 - UNRELEASED NEW FEATURES + YARN-1757. NM Recovery. Auxiliary service support. (Jason Lowe via kasha) + IMPROVEMENTS YARN-1479. Invalid NaN values in Hadoop REST API JSON response (Chen He via diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index f7d6b6ba97e7b..0a11948fc23f9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -884,6 +884,13 @@ public class YarnConfiguration extends Configuration { public static final String DEFAULT_NM_USER_HOME_DIR= "/home/"; + public static final String NM_RECOVERY_PREFIX = NM_PREFIX + "recovery."; + public static final String NM_RECOVERY_ENABLED = + NM_RECOVERY_PREFIX + "enabled"; + public static final boolean DEFAULT_NM_RECOVERY_ENABLED = false; + + public static final String NM_RECOVERY_DIR = NM_RECOVERY_PREFIX + "dir"; + //////////////////////////////// // Web Proxy Configs //////////////////////////////// diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java index 58b06e274a8a5..58b1d4a61a317 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java @@ -22,6 +22,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.fs.Path; import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.yarn.api.ContainerManagementProtocol; import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest; @@ -38,10 +39,21 @@ @Evolving public abstract class AuxiliaryService extends AbstractService { + private Path recoveryPath = null; + protected AuxiliaryService(String name) { super(name); } + /** + * Get the path specific to this auxiliary service to use for recovery. + * + * @return state storage path or null if recovery is not enabled + */ + protected Path getRecoveryPath() { + return recoveryPath; + } + /** * A new application is started on this NodeManager. This is a signal to * this {@link AuxiliaryService} about the application initialization. @@ -102,4 +114,13 @@ public void initializeContainer(ContainerInitializationContext public void stopContainer(ContainerTerminationContext stopContainerContext) { } + /** + * Set the path for this auxiliary service to use for storing state + * that will be used during recovery. + * + * @param recoveryPath where recoverable state should be stored + */ + public void setRecoveryPath(Path recoveryPath) { + this.recoveryPath = recoveryPath; + } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml index 325c7a166d54a..4a9b03af8971f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml @@ -1019,6 +1019,19 @@ <value>500</value> </property> + <property> + <description>Enable the node manager to recover after starting</description> + <name>yarn.nodemanager.recovery.enabled</name> + <value>false</value> + </property> + + <property> + <description>The local filesystem directory in which the node manager will + store state when recovery is enabled.</description> + <name>yarn.nodemanager.recovery.dir</name> + <value>${hadoop.tmp.dir}/yarn-nm-recovery</value> + </property> + <!--Map Reduce configuration--> <property> <name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name> diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java index 9688290acd7c4..57ff127dbaa8d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java @@ -28,6 +28,9 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.service.CompositeService; @@ -127,6 +130,20 @@ protected void serviceInit(Configuration conf) throws Exception { conf.setBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY, true); + boolean recoveryEnabled = conf.getBoolean( + YarnConfiguration.NM_RECOVERY_ENABLED, + YarnConfiguration.DEFAULT_NM_RECOVERY_ENABLED); + if (recoveryEnabled) { + FileSystem recoveryFs = FileSystem.getLocal(conf); + String recoveryDirName = conf.get(YarnConfiguration.NM_RECOVERY_DIR); + if (recoveryDirName == null) { + throw new IllegalArgumentException("Recovery is enabled but " + + YarnConfiguration.NM_RECOVERY_DIR + " is not set."); + } + Path recoveryRoot = new Path(recoveryDirName); + recoveryFs.mkdirs(recoveryRoot, new FsPermission((short)0700)); + } + NMContainerTokenSecretManager containerTokenSecretManager = new NMContainerTokenSecretManager(conf); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java index 5fe5b141bc00d..bf026796bf4ad 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java @@ -29,15 +29,18 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.service.Service; import org.apache.hadoop.service.ServiceStateChangeListener; import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.event.EventHandler; +import org.apache.hadoop.yarn.server.api.ApplicationInitializationContext; import org.apache.hadoop.yarn.server.api.ApplicationTerminationContext; import org.apache.hadoop.yarn.server.api.AuxiliaryService; -import org.apache.hadoop.yarn.server.api.ApplicationInitializationContext; import org.apache.hadoop.yarn.server.api.ContainerInitializationContext; import org.apache.hadoop.yarn.server.api.ContainerTerminationContext; @@ -46,6 +49,8 @@ public class AuxServices extends AbstractService implements ServiceStateChangeListener, EventHandler<AuxServicesEvent> { + static final String STATE_STORE_ROOT_NAME = "nm-aux-services"; + private static final Log LOG = LogFactory.getLog(AuxServices.class); protected final Map<String,AuxiliaryService> serviceMap; @@ -91,6 +96,17 @@ public Map<String, ByteBuffer> getMetaData() { @Override public void serviceInit(Configuration conf) throws Exception { + final FsPermission storeDirPerms = new FsPermission((short)0700); + Path stateStoreRoot = null; + FileSystem stateStoreFs = null; + boolean recoveryEnabled = conf.getBoolean( + YarnConfiguration.NM_RECOVERY_ENABLED, + YarnConfiguration.DEFAULT_NM_RECOVERY_ENABLED); + if (recoveryEnabled) { + stateStoreRoot = new Path(conf.get(YarnConfiguration.NM_RECOVERY_DIR), + STATE_STORE_ROOT_NAME); + stateStoreFs = FileSystem.getLocal(conf); + } Collection<String> auxNames = conf.getStringCollection( YarnConfiguration.NM_AUX_SERVICES); for (final String sName : auxNames) { @@ -119,6 +135,11 @@ public void serviceInit(Configuration conf) throws Exception { +"the name in the config."); } addService(sName, s); + if (recoveryEnabled) { + Path storePath = new Path(stateStoreRoot, sName); + stateStoreFs.mkdirs(storePath, storeDirPerms); + s.setRecoveryPath(storePath); + } s.init(conf); } catch (RuntimeException e) { LOG.fatal("Failed to initialize " + sName, e); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java index e14fddf00f235..b464dcc06f0ab 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java @@ -26,6 +26,8 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.File; +import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; @@ -36,6 +38,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.FileUtil; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.service.Service; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; @@ -56,6 +62,10 @@ public class TestAuxServices { private static final Log LOG = LogFactory.getLog(TestAuxServices.class); + private static final File TEST_DIR = new File( + System.getProperty("test.build.data", + System.getProperty("java.io.tmpdir")), + TestAuxServices.class.getName()); static class LightService extends AuxiliaryService implements Service { @@ -319,4 +329,81 @@ public void testValidAuxServiceName() { "should only contain a-zA-Z0-9_ and can not start with numbers")); } } + + @Test + public void testAuxServiceRecoverySetup() throws IOException { + Configuration conf = new YarnConfiguration(); + conf.setBoolean(YarnConfiguration.NM_RECOVERY_ENABLED, true); + conf.set(YarnConfiguration.NM_RECOVERY_DIR, TEST_DIR.toString()); + conf.setStrings(YarnConfiguration.NM_AUX_SERVICES, + new String[] { "Asrv", "Bsrv" }); + conf.setClass(String.format(YarnConfiguration.NM_AUX_SERVICE_FMT, "Asrv"), + RecoverableServiceA.class, Service.class); + conf.setClass(String.format(YarnConfiguration.NM_AUX_SERVICE_FMT, "Bsrv"), + RecoverableServiceB.class, Service.class); + try { + final AuxServices aux = new AuxServices(); + aux.init(conf); + Assert.assertEquals(2, aux.getServices().size()); + File auxStorageDir = new File(TEST_DIR, + AuxServices.STATE_STORE_ROOT_NAME); + Assert.assertEquals(2, auxStorageDir.listFiles().length); + aux.close(); + } finally { + FileUtil.fullyDelete(TEST_DIR); + } + } + + static class RecoverableAuxService extends AuxiliaryService { + static final FsPermission RECOVERY_PATH_PERMS = + new FsPermission((short)0700); + + String auxName; + + RecoverableAuxService(String name, String auxName) { + super(name); + this.auxName = auxName; + } + + @Override + protected void serviceInit(Configuration conf) throws Exception { + super.serviceInit(conf); + Path storagePath = getRecoveryPath(); + Assert.assertNotNull("Recovery path not present when aux service inits", + storagePath); + Assert.assertTrue(storagePath.toString().contains(auxName)); + FileSystem fs = FileSystem.getLocal(conf); + Assert.assertTrue("Recovery path does not exist", + fs.exists(storagePath)); + Assert.assertEquals("Recovery path has wrong permissions", + new FsPermission((short)0700), + fs.getFileStatus(storagePath).getPermission()); + } + + @Override + public void initializeApplication( + ApplicationInitializationContext initAppContext) { + } + + @Override + public void stopApplication(ApplicationTerminationContext stopAppContext) { + } + + @Override + public ByteBuffer getMetaData() { + return null; + } + } + + static class RecoverableServiceA extends RecoverableAuxService { + RecoverableServiceA() { + super("RecoverableServiceA", "Asrv"); + } + } + + static class RecoverableServiceB extends RecoverableAuxService { + RecoverableServiceB() { + super("RecoverableServiceB", "Bsrv"); + } + } }
44d92d8eb39b176c23209f26a69bb1febae8e812
kotlin
Support for checking loaded descriptors agains an- expected txt file--
a
https://github.com/JetBrains/kotlin
diff --git a/compiler/testData/lazyResolve/diagnostics/AbstractInAbstractClass.txt b/compiler/testData/lazyResolve/diagnostics/AbstractInAbstractClass.txt new file mode 100644 index 0000000000000..6a33d58b255ad --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/AbstractInAbstractClass.txt @@ -0,0 +1,38 @@ +namespace <root> + +// <namespace name="abstract"> +namespace abstract + +internal abstract class abstract.MyAbstractClass : jet.Any { + public final /*constructor*/ fun <init>(): abstract.MyAbstractClass + internal final val a1: jet.Int + internal abstract val a2: jet.Int + internal abstract val a3: jet.Int + internal final val a: jet.Int + internal final var b1: jet.Int private set + internal abstract var b2: jet.Int private set + internal abstract var b3: jet.Int private set + internal final var b: jet.Int private set + internal final var c1: jet.Int + internal abstract var c2: jet.Int + internal abstract var c3: jet.Int + internal final var c: jet.Int + internal final val e1: jet.Int + internal abstract val e2: jet.Int + internal abstract val e3: jet.Int + internal final val e: jet.Int + internal final fun f(): jet.Tuple0 + internal final fun g(): jet.Tuple0 + internal abstract fun h(): jet.Tuple0 + internal final var i1: jet.Int + internal final var i: jet.Int + internal abstract fun j(): jet.Tuple0 + internal final var j1: jet.Int + internal final var j: jet.Int + internal final var k1: jet.Int + internal final var k: jet.Int + internal final var l1: jet.Int + internal final var l: jet.Int + internal final var n: jet.Int +} +// </namespace name="abstract"> diff --git a/compiler/testData/lazyResolve/diagnostics/AbstractInClass.txt b/compiler/testData/lazyResolve/diagnostics/AbstractInClass.txt new file mode 100644 index 0000000000000..a80adecf038ff --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/AbstractInClass.txt @@ -0,0 +1,38 @@ +namespace <root> + +// <namespace name="abstract"> +namespace abstract + +internal final class abstract.MyClass : jet.Any { + public final /*constructor*/ fun <init>(): abstract.MyClass + internal final val a1: jet.Int + internal abstract val a2: jet.Int + internal abstract val a3: jet.Int + internal final val a: jet.Int + internal final var b1: jet.Int private set + internal abstract var b2: jet.Int private set + internal abstract var b3: jet.Int private set + internal final var b: jet.Int private set + internal final var c1: jet.Int + internal abstract var c2: jet.Int + internal abstract var c3: jet.Int + internal final var c: jet.Int + internal final val e1: jet.Int + internal abstract val e2: jet.Int + internal abstract val e3: jet.Int + internal final val e: jet.Int + internal final fun f(): jet.Tuple0 + internal final fun g(): jet.Tuple0 + internal abstract fun h(): jet.Tuple0 + internal final var i1: jet.Int + internal final var i: jet.Int + internal abstract fun j(): jet.Tuple0 + internal final var j1: jet.Int + internal final var j: jet.Int + internal final var k1: jet.Int + internal final var k: jet.Int + internal final var l1: jet.Int + internal final var l: jet.Int + internal final var n: jet.Int +} +// </namespace name="abstract"> diff --git a/compiler/testData/lazyResolve/diagnostics/AbstractInEnum.txt b/compiler/testData/lazyResolve/diagnostics/AbstractInEnum.txt new file mode 100644 index 0000000000000..bfb4e84b3dee2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/AbstractInEnum.txt @@ -0,0 +1,41 @@ +namespace <root> + +// <namespace name="abstract"> +namespace abstract + +internal final enum class abstract.MyEnum : jet.Any { + public final /*constructor*/ fun <init>(): abstract.MyEnum + internal final val a1: jet.Int + internal abstract val a2: jet.Int + internal abstract val a3: jet.Int + internal final val a: jet.Int + internal final var b1: jet.Int private set + internal abstract var b2: jet.Int private set + internal abstract var b3: jet.Int private set + internal final var b: jet.Int private set + internal final var c1: jet.Int + internal abstract var c2: jet.Int + internal abstract var c3: jet.Int + internal final var c: jet.Int + internal final val e1: jet.Int + internal abstract val e2: jet.Int + internal abstract val e3: jet.Int + internal final val e: jet.Int + internal final fun f(): jet.Tuple0 + internal final fun g(): jet.Tuple0 + internal abstract fun h(): jet.Tuple0 + internal final var i1: jet.Int + internal final var i: jet.Int + internal abstract fun j(): jet.Tuple0 + internal final var j1: jet.Int + internal final var j: jet.Int + internal final var k1: jet.Int + internal final var k: jet.Int + internal final var l1: jet.Int + internal final var l: jet.Int + internal final var n: jet.Int + internal final object abstract.MyEnum.<class-object-for-MyEnum> { + internal final /*constructor*/ fun <init>(): abstract.MyEnum.<class-object-for-MyEnum> + } +} +// </namespace name="abstract"> diff --git a/compiler/testData/lazyResolve/diagnostics/AbstractInTrait.txt b/compiler/testData/lazyResolve/diagnostics/AbstractInTrait.txt new file mode 100644 index 0000000000000..29cd19e059ff0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/AbstractInTrait.txt @@ -0,0 +1,37 @@ +namespace <root> + +// <namespace name="abstract"> +namespace abstract + +internal abstract trait abstract.MyTrait : jet.Any { + internal open val a1: jet.Int + internal abstract val a2: jet.Int + internal abstract val a3: jet.Int + internal abstract val a: jet.Int + internal open var b1: jet.Int private set + internal abstract var b2: jet.Int private set + internal abstract var b3: jet.Int private set + internal abstract var b: jet.Int private set + internal open var c1: jet.Int + internal abstract var c2: jet.Int + internal abstract var c3: jet.Int + internal open var c: jet.Int + internal open val e1: jet.Int + internal abstract val e2: jet.Int + internal abstract val e3: jet.Int + internal open val e: jet.Int + internal abstract fun f(): jet.Tuple0 + internal open fun g(): jet.Tuple0 + internal abstract fun h(): jet.Tuple0 + internal open var i1: jet.Int + internal abstract var i: jet.Int + internal abstract fun j(): jet.Tuple0 + internal open var j1: jet.Int + internal open var j: jet.Int + internal open var k1: jet.Int + internal abstract var k: jet.Int + internal open var l1: jet.Int + internal abstract var l: jet.Int + internal open var n: jet.Int +} +// </namespace name="abstract"> diff --git a/compiler/testData/lazyResolve/diagnostics/AnonymousInitializerVarAndConstructor.txt b/compiler/testData/lazyResolve/diagnostics/AnonymousInitializerVarAndConstructor.txt new file mode 100644 index 0000000000000..07b40dc4936a3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/AnonymousInitializerVarAndConstructor.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ w: jet.Int): A + internal final var c: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/AutoCreatedIt.txt b/compiler/testData/lazyResolve/diagnostics/AutoCreatedIt.txt new file mode 100644 index 0000000000000..4a777dce0acf5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/AutoCreatedIt.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal final class URI : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ body: jet.Any): URI + internal final val body: jet.Any + internal final fun to(/*0*/ dest: jet.String): jet.Tuple0 +} +internal final fun bar(/*0*/ f: jet.Function2<jet.Int, jet.Int, jet.Int>): jet.Tuple0 +internal final fun bar1(/*0*/ f: jet.Function1<jet.Int, jet.Int>): jet.Tuple0 +internal final fun bar2(/*0*/ f: jet.Function0<jet.Int>): jet.Tuple0 +internal final fun jet.String.on(/*0*/ predicate: jet.Function1<URI, jet.Boolean>): URI +internal final fun text(): jet.Tuple0 +internal final fun jet.String.to(/*0*/ dest: jet.String): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/AutocastAmbiguitites.txt b/compiler/testData/lazyResolve/diagnostics/AutocastAmbiguitites.txt new file mode 100644 index 0000000000000..3994283420339 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/AutocastAmbiguitites.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal abstract trait B : jet.Any { + internal open fun bar(): jet.Tuple0 +} +internal final class C : jet.Any { + public final /*constructor*/ fun <init>(): C + internal final fun bar(): jet.Tuple0 +} +internal final fun test(/*0*/ a: jet.Any?): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/AutocastsForStableIdentifiers.txt b/compiler/testData/lazyResolve/diagnostics/AutocastsForStableIdentifiers.txt new file mode 100644 index 0000000000000..70a42c9ba6ced --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/AutocastsForStableIdentifiers.txt @@ -0,0 +1,28 @@ +namespace <root> + +// <namespace name="example"> +namespace example + +// <namespace name="ns"> +namespace ns + +internal final val y: jet.Any? +// </namespace name="ns"> +internal final class example.AClass : jet.Any { + public final /*constructor*/ fun <init>(): example.AClass + internal final object example.AClass.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): example.AClass.<no name provided> + internal final val y: jet.Any? + } +} +internal open class example.C : jet.Any { + public final /*constructor*/ fun <init>(): example.C + internal final fun foo(): jet.Tuple0 +} +internal abstract trait example.T : jet.Any { +} +internal final val Obj: example.Obj +internal final val x: jet.Any? +internal final fun jet.Any?.foo(): jet.Int +internal final fun jet.Any?.vars(/*0*/ a: jet.Any?): jet.Int +// </namespace name="example"> diff --git a/compiler/testData/lazyResolve/diagnostics/Basic.txt b/compiler/testData/lazyResolve/diagnostics/Basic.txt new file mode 100644 index 0000000000000..9462dd9d5a717 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Basic.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final val x: jet.Int +} +internal final fun foo(/*0*/ u: jet.Tuple0): jet.Int +internal final fun foo1(): jet.Tuple0 +internal final fun test(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/BinaryCallsOnNullableValues.txt b/compiler/testData/lazyResolve/diagnostics/BinaryCallsOnNullableValues.txt new file mode 100644 index 0000000000000..c2ce323156deb --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/BinaryCallsOnNullableValues.txt @@ -0,0 +1,12 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A +} +internal final class B : jet.Any { + public final /*constructor*/ fun <init>(): B +} +internal final class C : jet.Any { + public final /*constructor*/ fun <init>(): C +} +internal final fun f(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/Bounds.txt b/compiler/testData/lazyResolve/diagnostics/Bounds.txt new file mode 100644 index 0000000000000..83f61dc32506a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Bounds.txt @@ -0,0 +1,38 @@ +namespace <root> + +// <namespace name="boundsWithSubstitutors"> +namespace boundsWithSubstitutors + +internal open class boundsWithSubstitutors.A</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): boundsWithSubstitutors.A<T> +} +internal final class boundsWithSubstitutors.B</*0*/ X : boundsWithSubstitutors.A<X>> : jet.Any { + public final /*constructor*/ fun </*0*/ X : boundsWithSubstitutors.A<X>><init>(): boundsWithSubstitutors.B<X> +} +internal final class boundsWithSubstitutors.C : boundsWithSubstitutors.A<boundsWithSubstitutors.C> { + public final /*constructor*/ fun <init>(): boundsWithSubstitutors.C +} +internal final class boundsWithSubstitutors.X</*0*/ A : jet.Any?, /*1*/ B : A> : jet.Any { + public final /*constructor*/ fun </*0*/ A : jet.Any?, /*1*/ B : A><init>(): boundsWithSubstitutors.X<A, B> +} +internal final val a: boundsWithSubstitutors.B<boundsWithSubstitutors.C> +internal final val a1: boundsWithSubstitutors.B<jet.Int> +internal final val b: boundsWithSubstitutors.X<jet.Any, boundsWithSubstitutors.X<boundsWithSubstitutors.A<boundsWithSubstitutors.C>, boundsWithSubstitutors.C>> +internal final val b0: boundsWithSubstitutors.X<jet.Any, jet.Any?> +internal final val b1: boundsWithSubstitutors.X<jet.Any, boundsWithSubstitutors.X<boundsWithSubstitutors.A<boundsWithSubstitutors.C>, jet.String>> +// </namespace name="boundsWithSubstitutors"> +internal open class A : jet.Any { + public final /*constructor*/ fun <init>(): A +} +internal open class B</*0*/ T : A> : jet.Any { + public final /*constructor*/ fun </*0*/ T : A><init>(): B<T> +} +internal abstract class C</*0*/ T : B<jet.Int>, /*1*/ X : jet.Function1<B<jet.Char>, jet.Tuple2<out B<jet.Any>, out B<A>>>> : B<jet.Any> { + public final /*constructor*/ fun </*0*/ T : B<jet.Int>, /*1*/ X : jet.Function1<B<jet.Char>, jet.Tuple2<out B<jet.Any>, out B<A>>>><init>(): C<T, X> + internal final val a: B<jet.Char> + internal abstract val x: jet.Function1<B<jet.Char>, B<jet.Any>> +} +internal final fun </*0*/ T : jet.Int?>bar(): jet.Tuple0 +internal final fun </*0*/ T : jet.Int>jet.Int.buzz(): jet.Tuple0 +internal final fun </*0*/ T : jet.Any>foo(): jet.Tuple0 +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/BreakContinue.txt b/compiler/testData/lazyResolve/diagnostics/BreakContinue.txt new file mode 100644 index 0000000000000..fa81ecd84b4c1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/BreakContinue.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal final class C : jet.Any { + public final /*constructor*/ fun <init>(): C + internal final fun containsBreak(/*0*/ a: jet.String?, /*1*/ b: jet.String?): jet.Tuple0 + internal final fun containsBreakInsideLoopWithLabel(/*0*/ a: jet.String?, /*1*/ array: jet.Array<jet.Int>): jet.Tuple0 + internal final fun containsBreakToOuterLoop(/*0*/ a: jet.String?, /*1*/ b: jet.String?): jet.Tuple0 + internal final fun containsBreakWithLabel(/*0*/ a: jet.String?): jet.Tuple0 + internal final fun containsIllegalBreak(/*0*/ a: jet.String?): jet.Tuple0 + internal final fun f(/*0*/ a: jet.Boolean, /*1*/ b: jet.Boolean): jet.Tuple0 + internal final fun notContainsBreak(/*0*/ a: jet.String?, /*1*/ b: jet.String?): jet.Tuple0 + internal final fun unresolvedBreak(/*0*/ a: jet.String?, /*1*/ array: jet.Array<jet.Int>): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/Builders.txt b/compiler/testData/lazyResolve/diagnostics/Builders.txt new file mode 100644 index 0000000000000..0644ee99f958a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Builders.txt @@ -0,0 +1,193 @@ +namespace <root> + +// <namespace name="html"> +namespace html + +internal final class html.A : html.BodyTag { + public final /*constructor*/ fun <init>(): html.A + internal final override /*1*/ fun a(/*0*/ href: jet.String, /*1*/ init: jet.ExtensionFunction0<html.A, jet.Tuple0>): jet.Tuple0 + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ fun b(/*0*/ init: jet.ExtensionFunction0<html.B, jet.Tuple0>): html.B + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final override /*1*/ fun h1(/*0*/ init: jet.ExtensionFunction0<html.H1, jet.Tuple0>): html.H1 + public final var href: jet.String? + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal final override /*1*/ fun p(/*0*/ init: jet.ExtensionFunction0<html.P, jet.Tuple0>): html.P + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final override /*1*/ fun ul(/*0*/ init: jet.ExtensionFunction0<html.UL, jet.Tuple0>): html.UL +} +internal final class html.B : html.BodyTag { + public final /*constructor*/ fun <init>(): html.B + internal final override /*1*/ fun a(/*0*/ href: jet.String, /*1*/ init: jet.ExtensionFunction0<html.A, jet.Tuple0>): jet.Tuple0 + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ fun b(/*0*/ init: jet.ExtensionFunction0<html.B, jet.Tuple0>): html.B + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final override /*1*/ fun h1(/*0*/ init: jet.ExtensionFunction0<html.H1, jet.Tuple0>): html.H1 + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal final override /*1*/ fun p(/*0*/ init: jet.ExtensionFunction0<html.P, jet.Tuple0>): html.P + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final override /*1*/ fun ul(/*0*/ init: jet.ExtensionFunction0<html.UL, jet.Tuple0>): html.UL +} +internal final class html.Body : html.BodyTag { + public final /*constructor*/ fun <init>(): html.Body + internal final override /*1*/ fun a(/*0*/ href: jet.String, /*1*/ init: jet.ExtensionFunction0<html.A, jet.Tuple0>): jet.Tuple0 + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ fun b(/*0*/ init: jet.ExtensionFunction0<html.B, jet.Tuple0>): html.B + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final override /*1*/ fun h1(/*0*/ init: jet.ExtensionFunction0<html.H1, jet.Tuple0>): html.H1 + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal final override /*1*/ fun p(/*0*/ init: jet.ExtensionFunction0<html.P, jet.Tuple0>): html.P + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final override /*1*/ fun ul(/*0*/ init: jet.ExtensionFunction0<html.UL, jet.Tuple0>): html.UL +} +internal abstract class html.BodyTag : html.TagWithText { + public final /*constructor*/ fun <init>(/*0*/ name: jet.String): html.BodyTag + internal final fun a(/*0*/ href: jet.String, /*1*/ init: jet.ExtensionFunction0<html.A, jet.Tuple0>): jet.Tuple0 + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final fun b(/*0*/ init: jet.ExtensionFunction0<html.B, jet.Tuple0>): html.B + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final fun h1(/*0*/ init: jet.ExtensionFunction0<html.H1, jet.Tuple0>): html.H1 + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal final fun p(/*0*/ init: jet.ExtensionFunction0<html.P, jet.Tuple0>): html.P + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final fun ul(/*0*/ init: jet.ExtensionFunction0<html.UL, jet.Tuple0>): html.UL +} +internal abstract trait html.Element : jet.Any { + internal abstract fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 +} +internal final class html.H1 : html.BodyTag { + public final /*constructor*/ fun <init>(): html.H1 + internal final override /*1*/ fun a(/*0*/ href: jet.String, /*1*/ init: jet.ExtensionFunction0<html.A, jet.Tuple0>): jet.Tuple0 + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ fun b(/*0*/ init: jet.ExtensionFunction0<html.B, jet.Tuple0>): html.B + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final override /*1*/ fun h1(/*0*/ init: jet.ExtensionFunction0<html.H1, jet.Tuple0>): html.H1 + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal final override /*1*/ fun p(/*0*/ init: jet.ExtensionFunction0<html.P, jet.Tuple0>): html.P + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final override /*1*/ fun ul(/*0*/ init: jet.ExtensionFunction0<html.UL, jet.Tuple0>): html.UL +} +internal final class html.HTML : html.TagWithText { + public final /*constructor*/ fun <init>(): html.HTML + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final fun body(/*0*/ init: jet.ExtensionFunction0<html.Body, jet.Tuple0>): html.Body + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final fun head(/*0*/ init: jet.ExtensionFunction0<html.Head, jet.Tuple0>): html.Head + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 +} +internal final class html.Head : html.TagWithText { + public final /*constructor*/ fun <init>(): html.Head + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final fun title(/*0*/ init: jet.ExtensionFunction0<html.Title, jet.Tuple0>): html.Title +} +internal final class html.LI : html.BodyTag { + public final /*constructor*/ fun <init>(): html.LI + internal final override /*1*/ fun a(/*0*/ href: jet.String, /*1*/ init: jet.ExtensionFunction0<html.A, jet.Tuple0>): jet.Tuple0 + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ fun b(/*0*/ init: jet.ExtensionFunction0<html.B, jet.Tuple0>): html.B + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final override /*1*/ fun h1(/*0*/ init: jet.ExtensionFunction0<html.H1, jet.Tuple0>): html.H1 + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal final override /*1*/ fun p(/*0*/ init: jet.ExtensionFunction0<html.P, jet.Tuple0>): html.P + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final override /*1*/ fun ul(/*0*/ init: jet.ExtensionFunction0<html.UL, jet.Tuple0>): html.UL +} +internal final class html.P : html.BodyTag { + public final /*constructor*/ fun <init>(): html.P + internal final override /*1*/ fun a(/*0*/ href: jet.String, /*1*/ init: jet.ExtensionFunction0<html.A, jet.Tuple0>): jet.Tuple0 + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ fun b(/*0*/ init: jet.ExtensionFunction0<html.B, jet.Tuple0>): html.B + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final override /*1*/ fun h1(/*0*/ init: jet.ExtensionFunction0<html.H1, jet.Tuple0>): html.H1 + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal final override /*1*/ fun p(/*0*/ init: jet.ExtensionFunction0<html.P, jet.Tuple0>): html.P + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final override /*1*/ fun ul(/*0*/ init: jet.ExtensionFunction0<html.UL, jet.Tuple0>): html.UL +} +internal abstract class html.Tag : html.Element { + public final /*constructor*/ fun <init>(/*0*/ name: jet.String): html.Tag + internal final val attributes: java.util.HashMap<jet.String, jet.String> + internal final val children: java.util.ArrayList<html.Element> + protected final fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + internal final val name: jet.String + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + private final fun renderAttributes(): jet.String? +} +internal abstract class html.TagWithText : html.Tag { + public final /*constructor*/ fun <init>(/*0*/ name: jet.String): html.TagWithText + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 +} +internal final class html.TextElement : html.Element { + public final /*constructor*/ fun <init>(/*0*/ text: jet.String): html.TextElement + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final val text: jet.String +} +internal final class html.Title : html.TagWithText { + public final /*constructor*/ fun <init>(): html.Title + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final override /*1*/ val name: jet.String + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 +} +internal final class html.UL : html.BodyTag { + public final /*constructor*/ fun <init>(): html.UL + internal final override /*1*/ fun a(/*0*/ href: jet.String, /*1*/ init: jet.ExtensionFunction0<html.A, jet.Tuple0>): jet.Tuple0 + internal final override /*1*/ val attributes: java.util.HashMap<jet.String, jet.String> + internal final override /*1*/ fun b(/*0*/ init: jet.ExtensionFunction0<html.B, jet.Tuple0>): html.B + internal final override /*1*/ val children: java.util.ArrayList<html.Element> + internal final override /*1*/ fun h1(/*0*/ init: jet.ExtensionFunction0<html.H1, jet.Tuple0>): html.H1 + protected final override /*1*/ fun </*0*/ T : html.Element>initTag(/*0*/ tag: T, /*1*/ init: jet.ExtensionFunction0<T, jet.Tuple0>): T + invisible_fake final override /*1*/ fun renderAttributes(): jet.String? + internal final override /*1*/ fun jet.String.plus(): jet.Tuple0 + internal final fun li(/*0*/ init: jet.ExtensionFunction0<html.LI, jet.Tuple0>): html.LI + internal final override /*1*/ val name: jet.String + internal final override /*1*/ fun p(/*0*/ init: jet.ExtensionFunction0<html.P, jet.Tuple0>): html.P + internal open override /*1*/ fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: jet.String): jet.Tuple0 + internal final override /*1*/ fun ul(/*0*/ init: jet.ExtensionFunction0<html.UL, jet.Tuple0>): html.UL +} +internal final fun html(/*0*/ init: jet.ExtensionFunction0<html.HTML, jet.Tuple0>): html.HTML +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun print(/*0*/ message: jet.Any?): jet.Tuple0 +internal final fun println(/*0*/ message: jet.Any?): jet.Tuple0 +internal final fun </*0*/ K : jet.Any?, /*1*/ V : jet.Any?>java.util.Map<K, V>.set(/*0*/ key: K, /*1*/ value: V): V? +// </namespace name="html"> diff --git a/compiler/testData/lazyResolve/diagnostics/Casts.txt b/compiler/testData/lazyResolve/diagnostics/Casts.txt new file mode 100644 index 0000000000000..8a9f72ae98682 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Casts.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/CharacterLiterals.txt b/compiler/testData/lazyResolve/diagnostics/CharacterLiterals.txt new file mode 100644 index 0000000000000..e35be5298b9a3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/CharacterLiterals.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(/*0*/ c: jet.Char): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/ClassObjectCannotAccessClassFields.txt b/compiler/testData/lazyResolve/diagnostics/ClassObjectCannotAccessClassFields.txt new file mode 100644 index 0000000000000..74e6380542bfd --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ClassObjectCannotAccessClassFields.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final val x: jet.Int + internal final object A.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): A.<no name provided> + internal final val y: [ERROR : Type for x] + } +} diff --git a/compiler/testData/lazyResolve/diagnostics/ClassObjects.txt b/compiler/testData/lazyResolve/diagnostics/ClassObjects.txt new file mode 100644 index 0000000000000..0c27cc88be657 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ClassObjects.txt @@ -0,0 +1,23 @@ +namespace <root> + +// <namespace name="Jet86"> +namespace Jet86 + +internal final class Jet86.A : jet.Any { + public final /*constructor*/ fun <init>(): Jet86.A + internal final object Jet86.A.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): Jet86.A.<no name provided> + internal final val x: jet.Int + } +} +internal final class Jet86.B : jet.Any { + public final /*constructor*/ fun <init>(): Jet86.B + internal final val x: jet.Int +} +internal final val a: jet.Int +internal final val b: Jet86.b +internal final val c: jet.Int +internal final val d: [ERROR : Type for b.x] +internal final val s: java.lang.System +internal final fun test(): jet.Tuple0 +// </namespace name="Jet86"> diff --git a/compiler/testData/lazyResolve/diagnostics/Constants.txt b/compiler/testData/lazyResolve/diagnostics/Constants.txt new file mode 100644 index 0000000000000..8a9f72ae98682 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Constants.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/CovariantOverrideType.txt b/compiler/testData/lazyResolve/diagnostics/CovariantOverrideType.txt new file mode 100644 index 0000000000000..a8b2c6cd8ada9 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/CovariantOverrideType.txt @@ -0,0 +1,23 @@ +namespace <root> + +internal abstract trait A : jet.Any { + internal abstract val a1: jet.Int + internal abstract val a: jet.Int + internal open fun foo(): jet.Int + internal open fun foo1(): jet.Int + internal open fun foo2(): jet.Int + internal abstract fun </*0*/ T : jet.Any?>g(): T + internal abstract fun </*0*/ T : jet.Any?>g1(): T + internal abstract val </*0*/ T : jet.Any?> g: jet.Iterator<T> +} +internal abstract class B : A { + public final /*constructor*/ fun <init>(): B + internal open override /*1*/ val a1: jet.Double + internal open override /*1*/ val a: jet.Double + internal open override /*1*/ fun foo(): jet.Tuple0 + internal open override /*1*/ fun foo1(): jet.Int + internal open override /*1*/ fun foo2(): jet.Tuple0 + internal abstract override /*1*/ fun </*0*/ X : jet.Any?>g(): jet.Int + internal abstract override /*1*/ fun </*0*/ X : jet.Any?>g1(): java.util.List<X> + internal abstract override /*1*/ val </*0*/ X : jet.Any?> g: jet.Iterator<jet.Int> +} diff --git a/compiler/testData/lazyResolve/diagnostics/DanglingFunctionLiteral.txt b/compiler/testData/lazyResolve/diagnostics/DanglingFunctionLiteral.txt new file mode 100644 index 0000000000000..1903119e88998 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/DanglingFunctionLiteral.txt @@ -0,0 +1,18 @@ +namespace <root> + +internal final class Foo : jet.Any { + public final /*constructor*/ fun <init>(): Foo + private final val builder: java.lang.StringBuilder +} +internal final class Foo1 : jet.Any { + public final /*constructor*/ fun <init>(): Foo1 + private final val builder: [ERROR : Type for StringBuilder("sdfsd") + + { + }] +} +internal final fun foo(): jet.Function0<[ERROR : <return type>]> +internal final fun foo1(): jet.Function0<jet.Function0<jet.Tuple0>> +internal final fun println(): jet.Tuple0 +internal final fun println(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun println(/*0*/ s: jet.Byte): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/DeferredTypes.txt b/compiler/testData/lazyResolve/diagnostics/DeferredTypes.txt new file mode 100644 index 0000000000000..ebfff80bc3a1b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/DeferredTypes.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal abstract trait T : jet.Any { + internal open val a: [ERROR : <ERROR FUNCTION RETURN TYPE>] +} diff --git a/compiler/testData/lazyResolve/diagnostics/DiamondFunction.txt b/compiler/testData/lazyResolve/diagnostics/DiamondFunction.txt new file mode 100644 index 0000000000000..8dbb888ad89b3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/DiamondFunction.txt @@ -0,0 +1,17 @@ +namespace <root> + +internal open class Base : jet.Any { + public final /*constructor*/ fun <init>(): Base + internal final fun f(): jet.Int +} +internal final class Diamond : Left, Right { + public final /*constructor*/ fun <init>(): Diamond + internal final override /*2*/ fun f(): jet.Int +} +internal open class Left : Base { + public final /*constructor*/ fun <init>(): Left + internal final override /*1*/ fun f(): jet.Int +} +internal abstract trait Right : Base { + internal final override /*1*/ fun f(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/DiamondFunctionGeneric.txt b/compiler/testData/lazyResolve/diagnostics/DiamondFunctionGeneric.txt new file mode 100644 index 0000000000000..7bc103a2e3a57 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/DiamondFunctionGeneric.txt @@ -0,0 +1,17 @@ +namespace <root> + +internal open class Base</*0*/ P : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): Base<P> + internal final fun f(): jet.Int +} +internal final class Diamond</*0*/ P : jet.Any?> : Left<P>, Right<P> { + public final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): Diamond<P> + internal final override /*2*/ fun f(): jet.Int +} +internal open class Left</*0*/ P : jet.Any?> : Base<P> { + public final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): Left<P> + internal final override /*1*/ fun f(): jet.Int +} +internal abstract trait Right</*0*/ P : jet.Any?> : Base<P> { + internal final override /*1*/ fun f(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/DiamondProperty.txt b/compiler/testData/lazyResolve/diagnostics/DiamondProperty.txt new file mode 100644 index 0000000000000..9481d4cb5c354 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/DiamondProperty.txt @@ -0,0 +1,17 @@ +namespace <root> + +internal open class Base : jet.Any { + public final /*constructor*/ fun <init>(): Base + internal final var v: jet.Int +} +internal final class Diamond : Left, Right { + public final /*constructor*/ fun <init>(): Diamond + internal final override /*2*/ var v: jet.Int +} +internal open class Left : Base { + public final /*constructor*/ fun <init>(): Left + internal final override /*1*/ var v: jet.Int +} +internal abstract trait Right : Base { + internal final override /*1*/ var v: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/Dollar.txt b/compiler/testData/lazyResolve/diagnostics/Dollar.txt new file mode 100644 index 0000000000000..4cd12fc808be5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Dollar.txt @@ -0,0 +1,17 @@ +namespace <root> + +// <namespace name="dollar"> +namespace dollar + +internal open class dollar.$ : jet.Any { + public final /*constructor*/ fun <init>(): dollar.$ +} +internal open class dollar.$$ : dollar.$ { + public open fun $$$$$$(): dollar.$$$$$? + internal final val $$$: dollar.$$$$$? + public final /*constructor*/ fun <init>(/*0*/ $$$$: dollar.$$$$$?): dollar.$$ +} +internal open class dollar.$$$$$ : jet.Any { + public final /*constructor*/ fun <init>(): dollar.$$$$$ +} +// </namespace name="dollar"> diff --git a/compiler/testData/lazyResolve/diagnostics/ForRangeConventions.txt b/compiler/testData/lazyResolve/diagnostics/ForRangeConventions.txt new file mode 100644 index 0000000000000..e159db65aeb05 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ForRangeConventions.txt @@ -0,0 +1,76 @@ +namespace <root> + +internal abstract class AmbiguousHasNextIterator : jet.Any { + public final /*constructor*/ fun <init>(): AmbiguousHasNextIterator + internal abstract fun hasNext(): jet.Boolean + internal final val hasNext: jet.Boolean + internal abstract fun next(): jet.Int +} +internal abstract class GoodIterator : jet.Any { + public final /*constructor*/ fun <init>(): GoodIterator + internal abstract fun hasNext(): jet.Boolean + internal abstract fun next(): jet.Int +} +internal abstract class ImproperIterator1 : jet.Any { + public final /*constructor*/ fun <init>(): ImproperIterator1 + internal abstract fun hasNext(): jet.Boolean +} +internal abstract class ImproperIterator2 : jet.Any { + public final /*constructor*/ fun <init>(): ImproperIterator2 + internal abstract fun next(): jet.Boolean +} +internal abstract class ImproperIterator3 : jet.Any { + public final /*constructor*/ fun <init>(): ImproperIterator3 + internal abstract fun hasNext(): jet.Int + internal abstract fun next(): jet.Int +} +internal abstract class ImproperIterator4 : jet.Any { + public final /*constructor*/ fun <init>(): ImproperIterator4 + internal final val hasNext: jet.Int + internal abstract fun next(): jet.Int +} +internal abstract class ImproperIterator5 : jet.Any { + public final /*constructor*/ fun <init>(): ImproperIterator5 + internal abstract val jet.String.hasNext: jet.Boolean + internal abstract fun next(): jet.Int +} +internal final class NotRange1 : jet.Any { + public final /*constructor*/ fun <init>(): NotRange1 +} +internal abstract class NotRange2 : jet.Any { + public final /*constructor*/ fun <init>(): NotRange2 + internal abstract fun iterator(): jet.Tuple0 +} +internal abstract class NotRange3 : jet.Any { + public final /*constructor*/ fun <init>(): NotRange3 + internal abstract fun iterator(): ImproperIterator1 +} +internal abstract class NotRange4 : jet.Any { + public final /*constructor*/ fun <init>(): NotRange4 + internal abstract fun iterator(): ImproperIterator2 +} +internal abstract class NotRange5 : jet.Any { + public final /*constructor*/ fun <init>(): NotRange5 + internal abstract fun iterator(): ImproperIterator3 +} +internal abstract class NotRange6 : jet.Any { + public final /*constructor*/ fun <init>(): NotRange6 + internal abstract fun iterator(): AmbiguousHasNextIterator +} +internal abstract class NotRange7 : jet.Any { + public final /*constructor*/ fun <init>(): NotRange7 + internal abstract fun iterator(): ImproperIterator3 +} +internal abstract class NotRange8 : jet.Any { + public final /*constructor*/ fun <init>(): NotRange8 + internal abstract fun iterator(): ImproperIterator5 +} +internal abstract class Range0 : jet.Any { + public final /*constructor*/ fun <init>(): Range0 + internal abstract fun iterator(): GoodIterator +} +internal abstract class Range1 : jet.Any { + public final /*constructor*/ fun <init>(): Range1 + internal abstract fun iterator(): java.util.Iterator<jet.Int> +} +internal final fun test(/*0*/ notRange1: NotRange1, /*1*/ notRange2: NotRange2, /*2*/ notRange3: NotRange3, /*3*/ notRange4: NotRange4, /*4*/ notRange5: NotRange5, /*5*/ notRange6: NotRange6, /*6*/ notRange7: NotRange7, /*7*/ notRange8: NotRange8, /*8*/ range0: Range0, /*9*/ range1: Range1): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/FunctionCalleeExpressions.txt b/compiler/testData/lazyResolve/diagnostics/FunctionCalleeExpressions.txt new file mode 100644 index 0000000000000..b053169382ca2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/FunctionCalleeExpressions.txt @@ -0,0 +1,15 @@ +namespace <root> + +// <namespace name="foo"> +namespace foo + +internal final fun f(): jet.ExtensionFunction0<jet.Int, jet.Tuple0> +internal final fun jet.Any.foo(): jet.Function0<jet.Tuple0> +internal final fun jet.Any.foo1(): jet.Function1<jet.Int, jet.Tuple0> +internal final fun foo2(): jet.Function1<jet.Function0<jet.Tuple0>, jet.Tuple0> +internal final fun </*0*/ T : jet.Any?>fooT1(/*0*/ t: T): jet.Function0<T> +internal final fun </*0*/ T : jet.Any?>fooT2(): jet.Function1<T, T> +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun main1(): jet.Tuple0 +internal final fun test(): jet.Tuple0 +// </namespace name="foo"> diff --git a/compiler/testData/lazyResolve/diagnostics/GenericArgumentConsistency.txt b/compiler/testData/lazyResolve/diagnostics/GenericArgumentConsistency.txt new file mode 100644 index 0000000000000..d7b4f71d64177 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/GenericArgumentConsistency.txt @@ -0,0 +1,72 @@ +namespace <root> + +// <namespace name="x"> +namespace x + +internal abstract trait x.AA1</*0*/ out T : jet.Any?> : jet.Any { +} +internal abstract trait x.AB1 : x.AA1<jet.Int> { +} +internal abstract trait x.AB2 : x.AA1<jet.Number>, x.AB1, x.AB3 { +} +internal abstract trait x.AB3 : x.AA1<jet.Comparable<jet.Int>> { +} +// </namespace name="x"> +// <namespace name="x2"> +namespace x2 + +internal abstract trait x2.AA1</*0*/ out T : jet.Any?> : jet.Any { +} +internal abstract trait x2.AB1 : x2.AA1<jet.Any> { +} +internal abstract trait x2.AB2 : x2.AA1<jet.Number>, x2.AB1, x2.AB3 { +} +internal abstract trait x2.AB3 : x2.AA1<jet.Comparable<jet.Int>> { +} +// </namespace name="x2"> +// <namespace name="x3"> +namespace x3 + +internal abstract trait x3.AA1</*0*/ in T : jet.Any?> : jet.Any { +} +internal abstract trait x3.AB1 : x3.AA1<jet.Any> { +} +internal abstract trait x3.AB2 : x3.AA1<jet.Number>, x3.AB1, x3.AB3 { +} +internal abstract trait x3.AB3 : x3.AA1<jet.Comparable<jet.Int>> { +} +// </namespace name="x3"> +// <namespace name="sx2"> +namespace sx2 + +internal abstract trait sx2.AA1</*0*/ in T : jet.Any?> : jet.Any { +} +internal abstract trait sx2.AB1 : sx2.AA1<jet.Int> { +} +internal abstract trait sx2.AB2 : sx2.AA1<jet.Number>, sx2.AB1, sx2.AB3 { +} +internal abstract trait sx2.AB3 : sx2.AA1<jet.Comparable<jet.Int>> { +} +// </namespace name="sx2"> +internal abstract trait A</*0*/ in T : jet.Any?> : jet.Any { +} +internal abstract trait A1</*0*/ out T : jet.Any?> : jet.Any { +} +internal abstract trait B</*0*/ T : jet.Any?> : A<jet.Int> { +} +internal abstract trait B1 : A1<jet.Int> { +} +internal abstract trait B2 : A1<jet.Any>, B1 { +} +internal abstract trait BA1</*0*/ T : jet.Any?> : jet.Any { +} +internal abstract trait BB1 : BA1<jet.Int> { +} +internal abstract trait BB2 : BA1<jet.Any>, BB1 { +} +internal abstract trait C</*0*/ T : jet.Any?> : B<T>, A<T> { +} +internal abstract trait C1</*0*/ T : jet.Any?> : B<T>, A<jet.Any> { +} +internal abstract trait D : C<jet.Boolean>, B<jet.Double> { +} diff --git a/compiler/testData/lazyResolve/diagnostics/GenericFunctionIsLessSpecific.txt b/compiler/testData/lazyResolve/diagnostics/GenericFunctionIsLessSpecific.txt new file mode 100644 index 0000000000000..e33defc249c35 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/GenericFunctionIsLessSpecific.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun foo(/*0*/ i: jet.Int): jet.Int +internal final fun </*0*/ T : jet.Any?>foo(/*0*/ t: T): jet.Tuple0 +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/IllegalModifiers.txt b/compiler/testData/lazyResolve/diagnostics/IllegalModifiers.txt new file mode 100644 index 0000000000000..cb266716a9b64 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/IllegalModifiers.txt @@ -0,0 +1,21 @@ +namespace <root> + +// <namespace name="illegal_modifiers"> +namespace illegal_modifiers + +internal abstract class illegal_modifiers.A : jet.Any { + public final /*constructor*/ fun <init>(): illegal_modifiers.A + internal abstract fun f(): jet.Tuple0 + internal abstract fun g(): jet.Tuple0 + internal open fun h(): jet.Tuple0 + internal open var r: jet.String protected set +} +internal final class illegal_modifiers.FinalClass : jet.Any { + public final /*constructor*/ fun <init>(): illegal_modifiers.FinalClass + internal open fun foo(): jet.Tuple0 + internal final val i: jet.Int + internal final var j: jet.Int +} +internal final trait illegal_modifiers.T : jet.Any { +} +// </namespace name="illegal_modifiers"> diff --git a/compiler/testData/lazyResolve/diagnostics/ImportResolutionOrder.txt b/compiler/testData/lazyResolve/diagnostics/ImportResolutionOrder.txt new file mode 100644 index 0000000000000..0619174a86c54 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ImportResolutionOrder.txt @@ -0,0 +1,26 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final val x: b.X +// </namespace name="a"> +// <namespace name="b"> +namespace b + +internal final class b.X : jet.Any { + public final /*constructor*/ fun <init>(): b.X +} +// </namespace name="b"> +// <namespace name="c"> +namespace c + +internal final val x: d.X +// </namespace name="c"> +// <namespace name="d"> +namespace d + +internal final class d.X : jet.Any { + public final /*constructor*/ fun <init>(): d.X +} +// </namespace name="d"> diff --git a/compiler/testData/lazyResolve/diagnostics/IncDec.txt b/compiler/testData/lazyResolve/diagnostics/IncDec.txt new file mode 100644 index 0000000000000..248cb16f4fd0d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/IncDec.txt @@ -0,0 +1,20 @@ +namespace <root> + +internal final class IncDec : jet.Any { + public final /*constructor*/ fun <init>(): IncDec + internal final fun dec(): IncDec + internal final fun inc(): IncDec +} +internal final class UnitIncDec : jet.Any { + public final /*constructor*/ fun <init>(): UnitIncDec + internal final fun dec(): jet.Tuple0 + internal final fun inc(): jet.Tuple0 +} +internal final class WrongIncDec : jet.Any { + public final /*constructor*/ fun <init>(): WrongIncDec + internal final fun dec(): jet.Int + internal final fun inc(): jet.Int +} +internal final fun testIncDec(): jet.Tuple0 +internal final fun testUnitIncDec(): jet.Tuple0 +internal final fun testWrongIncDec(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/IncorrectCharacterLiterals.txt b/compiler/testData/lazyResolve/diagnostics/IncorrectCharacterLiterals.txt new file mode 100644 index 0000000000000..a951870ff4ce0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/IncorrectCharacterLiterals.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun ff(): jet.Tuple0 +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/InferNullabilityInThenBlock.txt b/compiler/testData/lazyResolve/diagnostics/InferNullabilityInThenBlock.txt new file mode 100644 index 0000000000000..0c15629d47ff7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/InferNullabilityInThenBlock.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun ff(/*0*/ a: jet.String): jet.Int +internal final fun gg(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/IsExpressions.txt b/compiler/testData/lazyResolve/diagnostics/IsExpressions.txt new file mode 100644 index 0000000000000..8a9f72ae98682 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/IsExpressions.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/LValueAssignment.txt b/compiler/testData/lazyResolve/diagnostics/LValueAssignment.txt new file mode 100644 index 0000000000000..8632f0617bc51 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/LValueAssignment.txt @@ -0,0 +1,47 @@ +namespace <root> + +// <namespace name="lvalue_assignment"> +namespace lvalue_assignment + +internal final class lvalue_assignment.A : jet.Any { + public final /*constructor*/ fun <init>(): lvalue_assignment.A + internal final var a: jet.Int +} +internal abstract class lvalue_assignment.Ab : jet.Any { + public final /*constructor*/ fun <init>(): lvalue_assignment.Ab + internal abstract fun getArray(): jet.Array<jet.Int> +} +internal open class lvalue_assignment.B : jet.Any { + public final /*constructor*/ fun <init>(): lvalue_assignment.B + internal final var b: jet.Int + internal final val c: jet.Int +} +internal final class lvalue_assignment.C : lvalue_assignment.B { + public final /*constructor*/ fun <init>(): lvalue_assignment.C + internal final override /*1*/ var b: jet.Int + internal final fun bar(/*0*/ c: lvalue_assignment.C): jet.Tuple0 + internal final override /*1*/ val c: jet.Int + internal final fun foo(/*0*/ c: lvalue_assignment.C): jet.Tuple0 + internal final fun foo1(/*0*/ c: lvalue_assignment.C): jet.Tuple0 + internal final var x: jet.Int +} +internal final class lvalue_assignment.D : jet.Any { + public final /*constructor*/ fun <init>(): lvalue_assignment.D + internal final class lvalue_assignment.D.B : jet.Any { + public final /*constructor*/ fun <init>(): lvalue_assignment.D.B + internal final fun foo(): jet.Tuple0 + } +} +internal final class lvalue_assignment.Test : jet.Any { + public final /*constructor*/ fun <init>(): lvalue_assignment.Test + internal final fun testArrays(/*0*/ a: jet.Array<jet.Int>, /*1*/ ab: lvalue_assignment.Ab): jet.Tuple0 + internal final fun testIllegalValues(): jet.Tuple0 + internal final fun testVariables(): jet.Tuple0 + internal final fun testVariables1(): jet.Tuple0 +} +internal final fun canBe(/*0*/ i: jet.Int, /*1*/ j: jet.Int): jet.Tuple0 +internal final fun canBe2(/*0*/ j: jet.Int): jet.Tuple0 +internal final fun cannotBe(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun jet.Array<jet.Int>.checkThis(): jet.Tuple0 +internal final fun getInt(): jet.Int +// </namespace name="lvalue_assignment"> diff --git a/compiler/testData/lazyResolve/diagnostics/MergePackagesWithJava.txt b/compiler/testData/lazyResolve/diagnostics/MergePackagesWithJava.txt new file mode 100644 index 0000000000000..3c0a25e9c0e45 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/MergePackagesWithJava.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="java"> +namespace java + +internal final val c: java.lang.Class<out jet.Any?>? +internal final val </*0*/ T : jet.Any?> jet.Array<T>?.length: jet.Int +// </namespace name="java"> diff --git a/compiler/testData/lazyResolve/diagnostics/MultilineStringTemplates.txt b/compiler/testData/lazyResolve/diagnostics/MultilineStringTemplates.txt new file mode 100644 index 0000000000000..00b44512421d5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/MultilineStringTemplates.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun box(): jet.String +internal final fun new(): jet.String diff --git a/compiler/testData/lazyResolve/diagnostics/MultipleBounds.txt b/compiler/testData/lazyResolve/diagnostics/MultipleBounds.txt new file mode 100644 index 0000000000000..cce7292b9c8e3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/MultipleBounds.txt @@ -0,0 +1,54 @@ +namespace <root> + +// <namespace name="Jet87"> +namespace Jet87 + +internal open class Jet87.A : jet.Any { + public final /*constructor*/ fun <init>(): Jet87.A + internal final fun foo(): jet.Int +} +internal abstract trait Jet87.B : jet.Any { + internal open fun bar(): jet.Double +} +internal final class Jet87.Bar</*0*/ T : Jet87.Foo> : jet.Any { + public final /*constructor*/ fun </*0*/ T : Jet87.Foo><init>(): Jet87.Bar<T> +} +internal final class Jet87.Buzz</*0*/ T : Jet87.Bar<jet.Int> & [ERROR : nioho]> : jet.Any { + public final /*constructor*/ fun </*0*/ T : Jet87.Bar<jet.Int> & [ERROR : nioho]><init>(): Jet87.Buzz<T> +} +internal final class Jet87.C : Jet87.A, Jet87.B { + public final /*constructor*/ fun <init>(): Jet87.C + internal open override /*1*/ fun bar(): jet.Double + internal final override /*1*/ fun foo(): jet.Int +} +internal final class Jet87.D : jet.Any { + public final /*constructor*/ fun <init>(): Jet87.D + internal final object Jet87.D.<no name provided> : Jet87.A, Jet87.B { + internal final /*constructor*/ fun <init>(): Jet87.D.<no name provided> + internal open override /*1*/ fun bar(): jet.Double + internal final override /*1*/ fun foo(): jet.Int + } +} +internal final class Jet87.Foo : jet.Any { + public final /*constructor*/ fun <init>(): Jet87.Foo +} +internal final class Jet87.Test</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): Jet87.Test<T> +} +internal final class Jet87.Test1</*0*/ T : Jet87.A & Jet87.B> : jet.Any { + public final /*constructor*/ fun </*0*/ T : Jet87.A & Jet87.B><init>(): Jet87.Test1<T> + internal final fun test(/*0*/ t: T): jet.Tuple0 +} +internal final class Jet87.X</*0*/ T : Jet87.Foo> : jet.Any { + public final /*constructor*/ fun </*0*/ T : Jet87.Foo><init>(): Jet87.X<T> +} +internal final class Jet87.Y</*0*/ T : Jet87.Bar<Jet87.Foo> & Jet87.Foo> : jet.Any { + public final /*constructor*/ fun </*0*/ T : Jet87.Bar<Jet87.Foo> & Jet87.Foo><init>(): Jet87.Y<T> +} +internal final val t1: jet.Tuple0 +internal final val t2: jet.Tuple0 +internal final val t3: jet.Tuple0 +internal final val </*0*/ T : jet.Any?, /*1*/ B : T> x: jet.Int +internal final fun test(): jet.Tuple0 +internal final fun </*0*/ T : Jet87.A & Jet87.B>test2(/*0*/ t: T): jet.Tuple0 +// </namespace name="Jet87"> diff --git a/compiler/testData/lazyResolve/diagnostics/NamedArgumentsAndDefaultValues.txt b/compiler/testData/lazyResolve/diagnostics/NamedArgumentsAndDefaultValues.txt new file mode 100644 index 0000000000000..a69eda6ffd427 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/NamedArgumentsAndDefaultValues.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int = ?, /*1*/ y: jet.Int = ?, /*2*/ z: jet.String): jet.Tuple0 +internal final fun foo(/*0*/ a: jet.Int = ?, /*1*/ b: jet.String = ?): jet.Tuple0 +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/NamespaceInExpressionPosition.txt b/compiler/testData/lazyResolve/diagnostics/NamespaceInExpressionPosition.txt new file mode 100644 index 0000000000000..a4f7602345f66 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/NamespaceInExpressionPosition.txt @@ -0,0 +1,16 @@ +namespace <root> + +// <namespace name="foo"> +namespace foo + +internal final class foo.X : jet.Any { + public final /*constructor*/ fun <init>(): foo.X +} +internal final val s: [ERROR : Type for java] +internal final val ss: java.lang.System +internal final val sss: foo.X +internal final val xs: [ERROR : Type for lang] +internal final val xss: java.lang.System +internal final val xsss: foo.X +internal final val xssss: [ERROR : Type for foo] +// </namespace name="foo"> diff --git a/compiler/testData/lazyResolve/diagnostics/NamespaceQualified.txt b/compiler/testData/lazyResolve/diagnostics/NamespaceQualified.txt new file mode 100644 index 0000000000000..933451333f87c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/NamespaceQualified.txt @@ -0,0 +1,48 @@ +namespace <root> + +// <namespace name="foobar"> +namespace foobar + +// <namespace name="a"> +namespace a + +internal final val a: java.util.List<jet.Int>? +internal final val a1: [ERROR : List<Int>] +internal final val b: java.util.List<jet.Int>? +internal final val b1: [ERROR : util.List<Int>] +// </namespace name="a"> +internal abstract class foobar.Collection</*0*/ E : jet.Any?> : jet.Iterable<E> { + public final /*constructor*/ fun </*0*/ E : jet.Any?><init>(): foobar.Collection<E> + internal final fun </*0*/ O : jet.Any?>iterate(/*0*/ iteratee: foobar.Iteratee<E, O>): O + public abstract override /*1*/ fun iterator(): jet.Iterator<E> +} +internal abstract class foobar.Foo</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): foobar.Foo<T> + internal abstract val x: T +} +internal abstract class foobar.Iteratee</*0*/ in I : jet.Any?, /*1*/ out O : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ in I : jet.Any?, /*1*/ out O : jet.Any?><init>(): foobar.Iteratee<I, O> + internal abstract fun done(): O + internal abstract val isDone: jet.Boolean + internal abstract fun process(/*0*/ item: I): foobar.Iteratee<I, O> + internal abstract val result: O +} +internal final class foobar.StrangeIterateeImpl</*0*/ in I : jet.Any?, /*1*/ out O : jet.Any?> : foobar.Iteratee<I, O> { + public final /*constructor*/ fun </*0*/ in I : jet.Any?, /*1*/ out O : jet.Any?><init>(/*0*/ obj: O): foobar.StrangeIterateeImpl<I, O> + internal open override /*1*/ fun done(): O + internal open override /*1*/ val isDone: jet.Boolean + internal final val obj: O + internal open override /*1*/ fun process(/*0*/ item: I): foobar.Iteratee<I, O> + internal open override /*1*/ val result: O +} +internal abstract class foobar.Sum : foobar.Iteratee<jet.Int, jet.Int> { + public final /*constructor*/ fun <init>(): foobar.Sum + internal abstract override /*1*/ fun done(): jet.Int + internal abstract override /*1*/ val isDone: jet.Boolean + internal open override /*1*/ fun process(/*0*/ item: jet.Int): foobar.Iteratee<jet.Int, jet.Int> + internal abstract override /*1*/ val result: jet.Int +} +internal final val x1: java.util.List<jet.Int>? +internal final val y1: java.util.List<jet.Int>? +internal final fun </*0*/ O : jet.Any?>done(/*0*/ result: O): foobar.Iteratee<jet.Any?, O> +// </namespace name="foobar"> diff --git a/compiler/testData/lazyResolve/diagnostics/Nullability.txt b/compiler/testData/lazyResolve/diagnostics/Nullability.txt new file mode 100644 index 0000000000000..3b056c1c63314 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Nullability.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal final fun f(/*0*/ out: jet.String?): jet.Tuple0 +internal final fun f1(/*0*/ out: jet.String?): jet.Tuple0 +internal final fun f2(/*0*/ out: jet.String?): jet.Tuple0 +internal final fun f3(/*0*/ out: jet.String?): jet.Tuple0 +internal final fun f4(/*0*/ s: jet.String?): jet.Tuple0 +internal final fun f5(/*0*/ s: jet.String?): jet.Tuple0 +internal final fun f6(/*0*/ s: jet.String?): jet.Tuple0 +internal final fun f7(/*0*/ s: jet.String?, /*1*/ t: jet.String?): jet.Tuple0 +internal final fun f8(/*0*/ b: jet.String?, /*1*/ a: jet.String): jet.Tuple0 +internal final fun f9(/*0*/ a: jet.Int?): jet.Int +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/OverrideFunctionWithParamDefaultValue.txt b/compiler/testData/lazyResolve/diagnostics/OverrideFunctionWithParamDefaultValue.txt new file mode 100644 index 0000000000000..913fa03a2342b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/OverrideFunctionWithParamDefaultValue.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal abstract class B : jet.Any { + public final /*constructor*/ fun <init>(): B + internal abstract fun foo2(/*0*/ arg: jet.Int = ?): jet.Int +} +internal final class C : B { + public final /*constructor*/ fun <init>(): C + internal open override /*1*/ fun foo2(/*0*/ arg: jet.Int = ?): jet.Int +} +internal final fun invokeIt(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/OverridenFunctionAndSpecifiedTypeParameter.txt b/compiler/testData/lazyResolve/diagnostics/OverridenFunctionAndSpecifiedTypeParameter.txt new file mode 100644 index 0000000000000..92342e417610d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/OverridenFunctionAndSpecifiedTypeParameter.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal abstract trait Aaa</*0*/ T : jet.Any?> : jet.Any { + internal abstract fun zzz(/*0*/ value: T): jet.Tuple0 +} +internal final class Bbb</*0*/ T : jet.Any?> : Aaa<T> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): Bbb<T> + internal open override /*1*/ fun zzz(/*0*/ value: T): jet.Tuple0 +} +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/OverridingVarByVal.txt b/compiler/testData/lazyResolve/diagnostics/OverridingVarByVal.txt new file mode 100644 index 0000000000000..0c5baea4d586e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/OverridingVarByVal.txt @@ -0,0 +1,17 @@ +namespace <root> + +internal final class Val : Var, VarT { + public final /*constructor*/ fun <init>(): Val + internal open override /*2*/ val v: jet.Int +} +internal open class Var : jet.Any { + public final /*constructor*/ fun <init>(): Var + internal open var v: jet.Int +} +internal final class Var2 : Var { + public final /*constructor*/ fun <init>(): Var2 + internal open override /*1*/ var v: jet.Int +} +internal abstract trait VarT : jet.Any { + internal abstract var v: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/PrimaryConstructors.txt b/compiler/testData/lazyResolve/diagnostics/PrimaryConstructors.txt new file mode 100644 index 0000000000000..2b0d8518cc1c0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/PrimaryConstructors.txt @@ -0,0 +1,27 @@ +namespace <root> + +internal final class MyIterable</*0*/ T : jet.Any?> : jet.Iterable<T> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): MyIterable<T> + internal final class MyIterable.MyIterator : jet.Iterator<T> { + public final /*constructor*/ fun <init>(): MyIterable.MyIterator + public open override /*1*/ val hasNext: jet.Boolean + public open override /*1*/ fun next(): T + } + public open override /*1*/ fun iterator(): jet.Iterator<T> +} +internal final class X : jet.Any { + public final /*constructor*/ fun <init>(): X + internal final val x: jet.Int +} +internal open class Y : jet.Any { + public final /*constructor*/ fun <init>(): Y + internal final val x: jet.Int +} +internal final class Y1 : jet.Any { + public final /*constructor*/ fun <init>(): Y1 + internal final val x: jet.Int +} +internal final class Z : Y { + public final /*constructor*/ fun <init>(): Z + internal final override /*1*/ val x: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/ProcessingEmptyImport.txt b/compiler/testData/lazyResolve/diagnostics/ProcessingEmptyImport.txt new file mode 100644 index 0000000000000..e6dce1f6909d2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ProcessingEmptyImport.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun firstFun(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/ProjectionOnFunctionArgumentErrror.txt b/compiler/testData/lazyResolve/diagnostics/ProjectionOnFunctionArgumentErrror.txt new file mode 100644 index 0000000000000..8a9f72ae98682 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ProjectionOnFunctionArgumentErrror.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/ProjectionsInSupertypes.txt b/compiler/testData/lazyResolve/diagnostics/ProjectionsInSupertypes.txt new file mode 100644 index 0000000000000..9c693405742dd --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ProjectionsInSupertypes.txt @@ -0,0 +1,12 @@ +namespace <root> + +internal abstract trait A</*0*/ T : jet.Any?> : jet.Any { +} +internal abstract trait B</*0*/ T : jet.Any?> : jet.Any { +} +internal abstract trait C</*0*/ T : jet.Any?> : jet.Any { +} +internal abstract trait D</*0*/ T : jet.Any?> : jet.Any { +} +internal abstract trait Test : A<in jet.Int>, B<out jet.Int>, C<out jet.Any?>?, D<jet.Int> { +} diff --git a/compiler/testData/lazyResolve/diagnostics/QualifiedExpressions.txt b/compiler/testData/lazyResolve/diagnostics/QualifiedExpressions.txt new file mode 100644 index 0000000000000..d2f0498cb2632 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/QualifiedExpressions.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="qualified_expressions"> +namespace qualified_expressions + +internal final fun jet.String.startsWith(/*0*/ s: jet.String): jet.Boolean +internal final fun test(/*0*/ s: jet.String?): jet.Tuple0 +// </namespace name="qualified_expressions"> diff --git a/compiler/testData/lazyResolve/diagnostics/RecursiveTypeInference.txt b/compiler/testData/lazyResolve/diagnostics/RecursiveTypeInference.txt new file mode 100644 index 0000000000000..1553f6e4d5261 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/RecursiveTypeInference.txt @@ -0,0 +1,44 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final val foo: [ERROR : Error function type] +internal final fun bar(): [ERROR : Error function type] +// </namespace name="a"> +// <namespace name="b"> +namespace b + +internal final fun bar(): [ERROR : Error function type] +internal final fun foo(): [ERROR : Error function type] +// </namespace name="b"> +// <namespace name="c"> +namespace c + +internal final fun bar(): [ERROR : Error function type] +internal final fun bazz(): [ERROR : Error function type] +internal final fun foo(): [ERROR : Error function type] +// </namespace name="c"> +// <namespace name="ok"> +namespace ok + +// <namespace name="a"> +namespace a + +internal final val foo: jet.Int +internal final fun bar(): jet.Int +// </namespace name="a"> +// <namespace name="b"> +namespace b + +internal final fun bar(): jet.Int +internal final fun foo(): jet.Int +// </namespace name="b"> +// <namespace name="c"> +namespace c + +internal final fun bar(): jet.Int +internal final fun bazz(): jet.Int +internal final fun foo(): jet.Int +// </namespace name="c"> +// </namespace name="ok"> diff --git a/compiler/testData/lazyResolve/diagnostics/ResolveOfJavaGenerics.txt b/compiler/testData/lazyResolve/diagnostics/ResolveOfJavaGenerics.txt new file mode 100644 index 0000000000000..bed0e4ddbd870 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ResolveOfJavaGenerics.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 +internal final fun test(/*0*/ a: java.lang.Class<jet.Int>): jet.Tuple0 +internal final fun test(/*0*/ a: java.lang.Comparable<jet.Int>): jet.Tuple0 +internal final fun test(/*0*/ a: java.lang.annotation.RetentionPolicy): jet.Tuple0 +internal final fun test(/*0*/ a: java.util.ArrayList<jet.Int>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/Return.txt b/compiler/testData/lazyResolve/diagnostics/Return.txt new file mode 100644 index 0000000000000..efed81cc38cf1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Return.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final fun outer(): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/SafeCallNonNullReceiver.txt b/compiler/testData/lazyResolve/diagnostics/SafeCallNonNullReceiver.txt new file mode 100644 index 0000000000000..4b34c64649ab4 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/SafeCallNonNullReceiver.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/SafeCallNonNullReceiverReturnNull.txt b/compiler/testData/lazyResolve/diagnostics/SafeCallNonNullReceiverReturnNull.txt new file mode 100644 index 0000000000000..110b47cb0c189 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/SafeCallNonNullReceiverReturnNull.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun ff(): jet.Tuple0 +internal final fun jet.Int.gg(): jet.Nothing? diff --git a/compiler/testData/lazyResolve/diagnostics/ShiftFunctionTypes.txt b/compiler/testData/lazyResolve/diagnostics/ShiftFunctionTypes.txt new file mode 100644 index 0000000000000..581d4dbd0e762 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ShiftFunctionTypes.txt @@ -0,0 +1,50 @@ +namespace <root> + +// <namespace name="n"> +namespace n + +internal final class n.B : jet.Any { + public final /*constructor*/ fun <init>(): n.B +} +// </namespace name="n"> +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A +} +internal abstract class XXX : jet.Any { + public final /*constructor*/ fun <init>(): XXX + internal final val a11: jet.Function1<jet.Int, jet.Int>? + internal final val a12: jet.Function1<jet.Int, jet.Int>? + internal abstract val a13: jet.ExtensionFunction1<jet.Int, jet.Int, jet.Int> + internal abstract val a14: jet.ExtensionFunction1<n.B, jet.Int, jet.Int> + internal abstract val a152: jet.ExtensionFunction1<jet.Int?, jet.Int, jet.Int> + internal abstract val a15: jet.ExtensionFunction1<jet.Int?, jet.Int, jet.Int> + internal abstract val a16: jet.Function1<jet.Int, jet.Function1<jet.Int, jet.Int>> + internal abstract val a17: jet.ExtensionFunction1<jet.Function1<jet.Int, jet.Int>, jet.Int, jet.Int> + internal abstract val a18: jet.Function1<jet.Int, jet.Function1<jet.Int, jet.Int>> + internal abstract val a19: jet.Function1<jet.Function1<jet.Int, jet.Int>, jet.Int> + internal abstract val a1: [ERROR : package.Int] + internal abstract val a2: n.B + internal abstract val a31: n.B + internal abstract val a3: A + internal abstract val a4: A? + internal abstract val a5: A? + internal abstract val a6: A? + internal abstract val a7: jet.Function1<A, n.B> + internal abstract val a8: jet.Function2<A, n.B, n.B> + internal abstract val a: jet.Int +} +internal abstract class YYY : jet.Any { + public final /*constructor*/ fun <init>(): YYY + internal final val a11: jet.Function1<jet.Int, jet.Int>? + internal final val a12: jet.Function1<jet.Int, jet.Int>? + internal abstract val a13: jet.ExtensionFunction1<jet.Int, jet.Int, jet.Int> + internal abstract val a14: jet.ExtensionFunction1<n.B, jet.Int, jet.Int> + internal abstract val a152: jet.ExtensionFunction1<jet.Int?, jet.Int, jet.Int> + internal abstract val a15: jet.ExtensionFunction1<jet.Int?, jet.Int, jet.Int> + internal abstract val a16: jet.Function1<jet.Int, jet.Function1<jet.Int, jet.Int>> + internal abstract val a17: jet.ExtensionFunction1<jet.Function1<jet.Int, jet.Int>, jet.Int, jet.Int> + internal abstract val a18: jet.Function1<jet.Int, jet.Function1<jet.Int, jet.Int>> + internal abstract val a19: jet.Function1<jet.Function1<jet.Int, jet.Int>, jet.Int> + internal abstract val a7: jet.Function1<A, n.B> + internal abstract val a8: jet.Function2<A, n.B, n.B> +} diff --git a/compiler/testData/lazyResolve/diagnostics/StarsInFunctionCalls.txt b/compiler/testData/lazyResolve/diagnostics/StarsInFunctionCalls.txt new file mode 100644 index 0000000000000..4d09b4d1d98bc --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/StarsInFunctionCalls.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final fun foo(/*0*/ a: jet.Any?): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>getT(): jet.Tuple0 +internal final fun </*0*/ A : jet.Any?, /*1*/ B : jet.Any?>getTT(): jet.Tuple0 +internal final fun </*0*/ A : jet.Any?, /*1*/ B : jet.Any?, /*2*/ C : jet.Any?>getTTT(/*0*/ x: jet.Any): jet.Tuple0 +internal open fun main(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/StringTemplates.txt b/compiler/testData/lazyResolve/diagnostics/StringTemplates.txt new file mode 100644 index 0000000000000..9649148c965fc --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/StringTemplates.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun demo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/Super.txt b/compiler/testData/lazyResolve/diagnostics/Super.txt new file mode 100644 index 0000000000000..df3fcb4d8eb77 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Super.txt @@ -0,0 +1,43 @@ +namespace <root> + +// <namespace name="example"> +namespace example + +internal final class example.A</*0*/ E : jet.Any?> : example.C, example.T { + public final /*constructor*/ fun </*0*/ E : jet.Any?><init>(): example.A<E> + internal final override /*1*/ fun bar(): jet.Tuple0 + internal final class example.A.B : example.T { + public final /*constructor*/ fun <init>(): example.A.B + internal open override /*1*/ fun foo(): jet.Tuple0 + internal final fun test(): jet.Tuple0 + } + internal open override /*1*/ fun foo(): jet.Tuple0 + internal final fun test(): jet.Tuple0 +} +internal final class example.A1 : jet.Any { + public final /*constructor*/ fun <init>(): example.A1 + internal final fun test(): jet.Tuple0 +} +internal open class example.C : jet.Any { + public final /*constructor*/ fun <init>(): example.C + internal final fun bar(): jet.Tuple0 +} +internal final class example.CG : example.G<jet.Int> { + public final /*constructor*/ fun <init>(): example.CG + internal open override /*1*/ fun foo(): jet.Tuple0 + internal final fun test(): jet.Tuple0 +} +internal final class example.ERROR</*0*/ E : jet.Any?> { + public final /*constructor*/ fun </*0*/ E : jet.Any?><init>(): example.ERROR<E> + internal final fun test(): jet.Tuple0 +} +internal abstract trait example.G</*0*/ T : jet.Any?> : jet.Any { + internal open fun foo(): jet.Tuple0 +} +internal abstract trait example.T : jet.Any { + internal open fun foo(): jet.Tuple0 +} +internal final fun any(/*0*/ a: jet.Any): jet.Tuple0 +internal final fun foo(): jet.Tuple0 +internal final fun notAnExpression(): jet.Tuple0 +// </namespace name="example"> diff --git a/compiler/testData/lazyResolve/diagnostics/SyntaxErrorInTestHighlighting.txt b/compiler/testData/lazyResolve/diagnostics/SyntaxErrorInTestHighlighting.txt new file mode 100644 index 0000000000000..9e5beb4ac5740 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/SyntaxErrorInTestHighlighting.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun get(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/SyntaxErrorInTestHighlightingEof.txt b/compiler/testData/lazyResolve/diagnostics/SyntaxErrorInTestHighlightingEof.txt new file mode 100644 index 0000000000000..1604dc621422a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/SyntaxErrorInTestHighlightingEof.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun f(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/TypeInference.txt b/compiler/testData/lazyResolve/diagnostics/TypeInference.txt new file mode 100644 index 0000000000000..14c7a9d2f8986 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/TypeInference.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal final class C</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): C<T> + internal final fun foo(): T +} +internal final fun </*0*/ T : jet.Any?>bar(): C<T> +internal final fun foo(/*0*/ c: C<jet.Int>): jet.Tuple0 +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/UnitByDefaultForFunctionTypes.txt b/compiler/testData/lazyResolve/diagnostics/UnitByDefaultForFunctionTypes.txt new file mode 100644 index 0000000000000..bf498336f240c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/UnitByDefaultForFunctionTypes.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun foo(/*0*/ f: jet.Function0<jet.Tuple0>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/UnreachableCode.txt b/compiler/testData/lazyResolve/diagnostics/UnreachableCode.txt new file mode 100644 index 0000000000000..75755fdd9b953 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/UnreachableCode.txt @@ -0,0 +1,25 @@ +namespace <root> + +internal final fun blockAndAndMismatch(): jet.Boolean +internal final fun fail(): jet.Nothing +internal final fun failtest(/*0*/ a: jet.Int): jet.Int +internal final fun foo(/*0*/ a: jet.Nothing): jet.Tuple0 +internal final fun nullIsNotNothing(): jet.Tuple0 +internal final fun returnInWhile(/*0*/ a: jet.Int): jet.Tuple0 +internal final fun t1(): jet.Int +internal final fun t1a(): jet.Int +internal final fun t1b(): jet.Int +internal final fun t1c(): jet.Int +internal final fun t2(): jet.Int +internal final fun t2a(): jet.Int +internal final fun t3(): jet.Any +internal final fun t4(/*0*/ a: jet.Boolean): jet.Int +internal final fun t4break(/*0*/ a: jet.Boolean): jet.Int +internal final fun t5(): jet.Int +internal final fun t6(): jet.Int +internal final fun t6break(): jet.Int +internal final fun t7(): jet.Int +internal final fun t7(/*0*/ b: jet.Int): jet.Int +internal final fun t7break(/*0*/ b: jet.Int): jet.Int +internal final fun t8(): jet.Int +internal final fun tf(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/Unresolved.txt b/compiler/testData/lazyResolve/diagnostics/Unresolved.txt new file mode 100644 index 0000000000000..321166bec2707 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Unresolved.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="unresolved"> +namespace unresolved + +internal final fun foo1(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun testGenericArgumentsCount(): jet.Tuple0 +internal final fun testUnresolved(): jet.Tuple0 +// </namespace name="unresolved"> diff --git a/compiler/testData/lazyResolve/diagnostics/UnusedVariables.txt b/compiler/testData/lazyResolve/diagnostics/UnusedVariables.txt new file mode 100644 index 0000000000000..3a8d49385e4a3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/UnusedVariables.txt @@ -0,0 +1,31 @@ +namespace <root> + +// <namespace name="unused_variables"> +namespace unused_variables + +internal final class unused_variables.IncDec : jet.Any { + public final /*constructor*/ fun <init>(): unused_variables.IncDec + internal final fun dec(): unused_variables.IncDec + internal final fun inc(): unused_variables.IncDec +} +internal final class unused_variables.MyTest : jet.Any { + public final /*constructor*/ fun <init>(): unused_variables.MyTest + internal final var a: jet.String + internal final fun doSmth(/*0*/ a: jet.Any): jet.Tuple0 + internal final fun doSmth(/*0*/ s: jet.String): jet.Tuple0 + internal final fun testFor(): jet.Tuple0 + internal final fun testIf(): jet.Tuple0 + internal final fun testIncDec(): jet.Tuple0 + internal final fun testSimple(): jet.Tuple0 + internal final fun testWhile(): jet.Tuple0 +} +internal abstract trait unused_variables.Trait : jet.Any { + internal abstract fun foo(): jet.Tuple0 +} +internal final fun doSmth(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun testBackingFieldsNotMarked(): jet.Tuple0 +internal final fun testFunctionLiterals(): jet.Tuple0 +internal final fun testInnerFunctions(): jet.Tuple0 +internal final fun testObject(): unused_variables.Trait +internal final fun testSimpleCases(): jet.Tuple0 +// </namespace name="unused_variables"> diff --git a/compiler/testData/lazyResolve/diagnostics/ValAndFunOverrideCompatibilityClash.txt b/compiler/testData/lazyResolve/diagnostics/ValAndFunOverrideCompatibilityClash.txt new file mode 100644 index 0000000000000..fee77e3333484 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/ValAndFunOverrideCompatibilityClash.txt @@ -0,0 +1,42 @@ +namespace <root> + +internal open class Bar : jet.Any { + public final /*constructor*/ fun <init>(): Bar + internal final fun v(): jet.Int + internal final val v: jet.Int +} +internal final class Barr : Bar { + public final /*constructor*/ fun <init>(): Barr + internal final override /*1*/ fun v(): jet.Int + internal final override /*1*/ val v: jet.Int +} +internal final class Foo1 : java.util.ArrayList<jet.Int> { + public final /*constructor*/ fun <init>(): Foo1 + public open override /*1*/ fun add(/*0*/ p0: jet.Int): jet.Boolean + public open override /*1*/ fun add(/*0*/ p0: jet.Int, /*1*/ p1: jet.Int): jet.Tuple0 + public open override /*1*/ fun addAll(/*0*/ p0: java.util.Collection<out jet.Int>): jet.Boolean + public open override /*1*/ fun addAll(/*0*/ p0: jet.Int, /*1*/ p1: java.util.Collection<out jet.Int>): jet.Boolean + public open override /*1*/ fun clear(): jet.Tuple0 + public open override /*1*/ fun contains(/*0*/ p0: jet.Any?): jet.Boolean + public open override /*1*/ fun containsAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + public open override /*1*/ fun ensureCapacity(/*0*/ p0: jet.Int): jet.Tuple0 + public open override /*1*/ fun get(/*0*/ p0: jet.Int): jet.Int + public open override /*1*/ fun indexOf(/*0*/ p0: jet.Any?): jet.Int + public open override /*1*/ fun isEmpty(): jet.Boolean + public open override /*1*/ fun iterator(): java.util.Iterator<jet.Int> + public open override /*1*/ fun lastIndexOf(/*0*/ p0: jet.Any?): jet.Int + public open override /*1*/ fun listIterator(): java.util.ListIterator<jet.Int> + public open override /*1*/ fun listIterator(/*0*/ p0: jet.Int): java.util.ListIterator<jet.Int> + protected final override /*1*/ var modCount: jet.Int + public open override /*1*/ fun remove(/*0*/ p0: jet.Any?): jet.Boolean + public open override /*1*/ fun remove(/*0*/ p0: jet.Int): jet.Int + public open override /*1*/ fun removeAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + protected open override /*1*/ fun removeRange(/*0*/ p0: jet.Int, /*1*/ p1: jet.Int): jet.Tuple0 + public open override /*1*/ fun retainAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + public open override /*1*/ fun set(/*0*/ p0: jet.Int, /*1*/ p1: jet.Int): jet.Int + public open override /*1*/ fun size(): jet.Int + public open override /*1*/ fun subList(/*0*/ p0: jet.Int, /*1*/ p1: jet.Int): java.util.List<jet.Int> + public open override /*1*/ fun toArray(): jet.Array<jet.Any?> + public open override /*1*/ fun </*0*/ T : jet.Any?>toArray(/*0*/ p0: jet.Array<T>): jet.Array<T> + public open override /*1*/ fun trimToSize(): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/VarargTypes.txt b/compiler/testData/lazyResolve/diagnostics/VarargTypes.txt new file mode 100644 index 0000000000000..d90e2180771ec --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/VarargTypes.txt @@ -0,0 +1,12 @@ +namespace <root> + +internal final fun foob(/*0*/ vararg a: jet.Boolean /*jet.BooleanArray*/): jet.BooleanArray +internal final fun foob(/*0*/ vararg a: jet.Byte /*jet.ByteArray*/): jet.ByteArray +internal final fun fooc(/*0*/ vararg a: jet.Char /*jet.CharArray*/): jet.CharArray +internal final fun food(/*0*/ vararg a: jet.Double /*jet.DoubleArray*/): jet.DoubleArray +internal final fun foof(/*0*/ vararg a: jet.Float /*jet.FloatArray*/): jet.FloatArray +internal final fun fooi(/*0*/ vararg a: jet.Int /*jet.IntArray*/): jet.IntArray +internal final fun fool(/*0*/ vararg a: jet.Long /*jet.LongArray*/): jet.LongArray +internal final fun foos(/*0*/ vararg a: jet.Short /*jet.ShortArray*/): jet.ShortArray +internal final fun foos(/*0*/ vararg a: jet.String /*jet.Array<jet.String>*/): jet.Array<jet.String> +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/Varargs.txt b/compiler/testData/lazyResolve/diagnostics/Varargs.txt new file mode 100644 index 0000000000000..457d4575615d9 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Varargs.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 +internal final fun v(/*0*/ x: jet.Int, /*1*/ y: jet.String, /*2*/ vararg f: jet.Long /*jet.LongArray*/): jet.Tuple0 +internal final fun v1(/*0*/ vararg f: jet.Function1<jet.Int, jet.Tuple0> /*jet.Array<jet.Function1<jet.Int, jet.Tuple0>>*/): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/Variance.txt b/compiler/testData/lazyResolve/diagnostics/Variance.txt new file mode 100644 index 0000000000000..95659be921597 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/Variance.txt @@ -0,0 +1,28 @@ +namespace <root> + +// <namespace name="variance"> +namespace variance + +internal final class variance.Array</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ length: jet.Int, /*1*/ t: T): variance.Array<T> + internal final fun get(/*0*/ index: jet.Int): T + internal final val length: jet.Int + internal final fun set(/*0*/ index: jet.Int, /*1*/ value: T): jet.Tuple0 + internal final val t: T +} +internal abstract class variance.Consumer</*0*/ in T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ in T : jet.Any?><init>(): variance.Consumer<T> +} +internal abstract class variance.Producer</*0*/ out T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ out T : jet.Any?><init>(): variance.Producer<T> +} +internal abstract class variance.Usual</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): variance.Usual<T> +} +internal final fun copy1(/*0*/ from: variance.Array<jet.Any>, /*1*/ to: variance.Array<jet.Any>): jet.Tuple0 +internal final fun copy2(/*0*/ from: variance.Array<out jet.Any>, /*1*/ to: variance.Array<in jet.Any>): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>copy3(/*0*/ from: variance.Array<out T>, /*1*/ to: variance.Array<in T>): jet.Tuple0 +internal final fun copy4(/*0*/ from: variance.Array<out jet.Number>, /*1*/ to: variance.Array<in jet.Int>): jet.Tuple0 +internal final fun f(/*0*/ ints: variance.Array<jet.Int>, /*1*/ any: variance.Array<jet.Any>, /*2*/ numbers: variance.Array<jet.Number>): jet.Tuple0 +internal final fun foo(/*0*/ c: variance.Consumer<jet.Int>, /*1*/ p: variance.Producer<jet.Int>, /*2*/ u: variance.Usual<jet.Int>): jet.Tuple0 +// </namespace name="variance"> diff --git a/compiler/testData/lazyResolve/diagnostics/When.txt b/compiler/testData/lazyResolve/diagnostics/When.txt new file mode 100644 index 0000000000000..a1ad99df2f40c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/When.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final val _type_test: jet.Int +internal final val jet.Tuple2<out jet.Int, out jet.Int>.boo: jet.Tuple3<out jet.Int, out jet.Int, out jet.Int> +internal final fun foo(): jet.Int +internal final fun jet.Int.foo(): jet.Boolean +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/annotations/AnnotatedConstructorParams.txt b/compiler/testData/lazyResolve/diagnostics/annotations/AnnotatedConstructorParams.txt new file mode 100644 index 0000000000000..83c777808a905 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/annotations/AnnotatedConstructorParams.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final class a.Test : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ s: jet.String, /*1*/ x: jet.Int): a.Test + internal final java.lang.Deprecated() val s: jet.String + internal final java.lang.SuppressWarnings() val x: jet.Int +} +internal final java.lang.Deprecated() java.lang.SuppressWarnings() val s: jet.String +internal final java.lang.Deprecated() java.lang.SuppressWarnings() fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/annotations/AnnotationsForClasses.txt b/compiler/testData/lazyResolve/diagnostics/annotations/AnnotationsForClasses.txt new file mode 100644 index 0000000000000..18ad41ac19506 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/annotations/AnnotationsForClasses.txt @@ -0,0 +1,8 @@ +namespace <root> + +java.lang.Deprecated() internal final annotation class my : jet.Any { + public final /*constructor*/ fun <init>(): my +} +java.lang.Deprecated() internal final annotation class my1 : jet.Any { + public final /*constructor*/ fun <init>(): my1 +} diff --git a/compiler/testData/lazyResolve/diagnostics/annotations/Deprecated.txt b/compiler/testData/lazyResolve/diagnostics/annotations/Deprecated.txt new file mode 100644 index 0000000000000..24000a5e05586 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/annotations/Deprecated.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final java.lang.Deprecated() fun foo(): jet.Tuple0 +internal final java.lang.Deprecated() fun foo1(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/annotations/NonAnnotationClass.txt b/compiler/testData/lazyResolve/diagnostics/annotations/NonAnnotationClass.txt new file mode 100644 index 0000000000000..8bca4d4d609c5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/annotations/NonAnnotationClass.txt @@ -0,0 +1,8 @@ +namespace <root> + +Foo() internal final class Bar : jet.Any { + public final /*constructor*/ fun <init>(): Bar +} +internal final class Foo : jet.Any { + public final /*constructor*/ fun <init>(): Foo +} diff --git a/compiler/testData/lazyResolve/diagnostics/annotations/kt1860-negative.txt b/compiler/testData/lazyResolve/diagnostics/annotations/kt1860-negative.txt new file mode 100644 index 0000000000000..d2076c739d397 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/annotations/kt1860-negative.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final class Hello : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ args: jet.Any): Hello +} +internal final var bar: jet.Int +internal final val x: jet.Function1<jet.Int, jet.Int> +internal final fun foo(/*0*/ f: jet.Int): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/annotations/kt1860-positive.txt b/compiler/testData/lazyResolve/diagnostics/annotations/kt1860-positive.txt new file mode 100644 index 0000000000000..dddd8b16fdfcb --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/annotations/kt1860-positive.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal final class Hello : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ args: jet.Any): Hello +} +internal final annotation class test : jet.Any { + public final /*constructor*/ fun <init>(): test +} +internal final var bar: jet.Int +internal final val x: jet.Function1<jet.Int, jet.Int> +internal final fun foo(/*0*/ f: jet.Int): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetSet.txt b/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetSet.txt new file mode 100644 index 0000000000000..025b5c5673870 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetSet.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class Flower : jet.Any { + public final /*constructor*/ fun <init>(): Flower + internal final var minusOne: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetVal.txt b/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetVal.txt new file mode 100644 index 0000000000000..52d4a9fa35e3c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetVal.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class CustomGetVal : jet.Any { + public final /*constructor*/ fun <init>(): CustomGetVal + internal final val zz: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetValGlobal.txt b/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetValGlobal.txt new file mode 100644 index 0000000000000..8ad18bb2c26ab --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetValGlobal.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="customGetValGlobal"> +namespace customGetValGlobal + +internal final val zz: jet.Int +// </namespace name="customGetValGlobal"> diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetVar.txt b/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetVar.txt new file mode 100644 index 0000000000000..17212ccffec56 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/CustomGetVar.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class Raise : jet.Any { + public final /*constructor*/ fun <init>(): Raise + internal final var zz: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/CustomSet.txt b/compiler/testData/lazyResolve/diagnostics/backingField/CustomSet.txt new file mode 100644 index 0000000000000..17212ccffec56 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/CustomSet.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class Raise : jet.Any { + public final /*constructor*/ fun <init>(): Raise + internal final var zz: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/CyclicReferenceInitializer.txt b/compiler/testData/lazyResolve/diagnostics/backingField/CyclicReferenceInitializer.txt new file mode 100644 index 0000000000000..cb1b1edaa39fd --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/CyclicReferenceInitializer.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class Cyclic : jet.Any { + public final /*constructor*/ fun <init>(): Cyclic + internal final val a: [ERROR : Type for $a] +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadForwardInAnonymous.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadForwardInAnonymous.txt new file mode 100644 index 0000000000000..9c76cad0dbf21 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadForwardInAnonymous.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class ReadForward : jet.Any { + public final /*constructor*/ fun <init>(): ReadForward + internal final val a: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadForwardInPropertyInitializer.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadForwardInPropertyInitializer.txt new file mode 100644 index 0000000000000..65e929a806352 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadForwardInPropertyInitializer.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class ReadForward : jet.Any { + public final /*constructor*/ fun <init>(): ReadForward + internal final val a: jet.Int + internal final val b: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadInAnonymous.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadInAnonymous.txt new file mode 100644 index 0000000000000..a2ed75745f0ca --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadInAnonymous.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class ReadByAnotherPropertyInitializer : jet.Any { + public final /*constructor*/ fun <init>(): ReadByAnotherPropertyInitializer + internal final val a: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadInAnotherPropertyIntializer.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadInAnotherPropertyIntializer.txt new file mode 100644 index 0000000000000..4b1223d1f7f9b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadInAnotherPropertyIntializer.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class ReadByAnotherPropertyInitializer : jet.Any { + public final /*constructor*/ fun <init>(): ReadByAnotherPropertyInitializer + internal final val a: jet.Int + internal final val b: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadInFunction.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadInFunction.txt new file mode 100644 index 0000000000000..f87e66d9ed7fe --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadInFunction.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class ReadByAnotherPropertyInitializer : jet.Any { + public final /*constructor*/ fun <init>(): ReadByAnotherPropertyInitializer + internal final val a: jet.Int + internal final fun ff(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentAbstractPropertyInAnonymous.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentAbstractPropertyInAnonymous.txt new file mode 100644 index 0000000000000..c10d13a95d7c2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentAbstractPropertyInAnonymous.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal abstract class ReadNonexistent : jet.Any { + public final /*constructor*/ fun <init>(): ReadNonexistent + internal abstract val aa: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentAbstractPropertyInFunction.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentAbstractPropertyInFunction.txt new file mode 100644 index 0000000000000..7e0c411af0c12 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentAbstractPropertyInFunction.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal abstract class ReadNonexistent : jet.Any { + public final /*constructor*/ fun <init>(): ReadNonexistent + internal abstract val aa: jet.Int + internal final fun ff(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentCustomGetInAnonymous.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentCustomGetInAnonymous.txt new file mode 100644 index 0000000000000..05b6b85d81656 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentCustomGetInAnonymous.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class ReadNonexistent : jet.Any { + public final /*constructor*/ fun <init>(): ReadNonexistent + internal final val a: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentCustomGetInAnotherInitializer.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentCustomGetInAnotherInitializer.txt new file mode 100644 index 0000000000000..5ef8889422ca3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentCustomGetInAnotherInitializer.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class CustomValNoBackingField : jet.Any { + public final /*constructor*/ fun <init>(): CustomValNoBackingField + internal final val a: jet.Int + internal final val b: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentDeclaredInHigher.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentDeclaredInHigher.txt new file mode 100644 index 0000000000000..5ef8889422ca3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentDeclaredInHigher.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class CustomValNoBackingField : jet.Any { + public final /*constructor*/ fun <init>(): CustomValNoBackingField + internal final val a: jet.Int + internal final val b: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentPropertyInAnonymous.txt b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentPropertyInAnonymous.txt new file mode 100644 index 0000000000000..f5e51236dd169 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/ReadNonexistentPropertyInAnonymous.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final class Cl : jet.Any { + public final /*constructor*/ fun <init>(): Cl +} diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/WriteNonexistentDeclaredInHigher.txt b/compiler/testData/lazyResolve/diagnostics/backingField/WriteNonexistentDeclaredInHigher.txt new file mode 100644 index 0000000000000..a6ff6ca2ea4f7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/WriteNonexistentDeclaredInHigher.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A +} +internal final val y: jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/backingField/kt782namespaceLevel.txt b/compiler/testData/lazyResolve/diagnostics/backingField/kt782namespaceLevel.txt new file mode 100644 index 0000000000000..d9515e7f06817 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/backingField/kt782namespaceLevel.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="kt782"> +namespace kt782 + +internal final val w: jet.Int +internal final val x: jet.Int +internal final val y: jet.Int +internal final val z: jet.Int +internal final fun foo(): jet.Tuple0 +// </namespace name="kt782"> diff --git a/compiler/testData/lazyResolve/diagnostics/cast/AsErasedError.txt b/compiler/testData/lazyResolve/diagnostics/cast/AsErasedError.txt new file mode 100644 index 0000000000000..e233c5d10460f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/AsErasedError.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(/*0*/ c: java.util.Collection<jet.String>): java.util.List<jet.Int> diff --git a/compiler/testData/lazyResolve/diagnostics/cast/AsErasedFine.txt b/compiler/testData/lazyResolve/diagnostics/cast/AsErasedFine.txt new file mode 100644 index 0000000000000..ee02aa3c317ba --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/AsErasedFine.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(/*0*/ c: java.util.Collection<jet.String>): java.util.List<jet.String> diff --git a/compiler/testData/lazyResolve/diagnostics/cast/AsErasedStar.txt b/compiler/testData/lazyResolve/diagnostics/cast/AsErasedStar.txt new file mode 100644 index 0000000000000..d874bb393cb18 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/AsErasedStar.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(/*0*/ l: jet.Any): java.util.List<out jet.Any?> diff --git a/compiler/testData/lazyResolve/diagnostics/cast/AsErasedWarning.txt b/compiler/testData/lazyResolve/diagnostics/cast/AsErasedWarning.txt new file mode 100644 index 0000000000000..1e2d05dd9b65e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/AsErasedWarning.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(/*0*/ a: jet.Any): java.util.List<jet.String> diff --git a/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowParameterSubtype.txt b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowParameterSubtype.txt new file mode 100644 index 0000000000000..f1bdab4041f12 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowParameterSubtype.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal open class A : jet.Any { + public final /*constructor*/ fun <init>(): A +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B +} +internal final fun ff(/*0*/ l: java.util.Collection<B>): jet.Boolean diff --git a/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowSameClassParameter.txt b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowSameClassParameter.txt new file mode 100644 index 0000000000000..7b4c0b36f09ee --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowSameClassParameter.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(/*0*/ l: java.util.Collection<jet.String>): jet.Boolean diff --git a/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowSameParameterParameter.txt b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowSameParameterParameter.txt new file mode 100644 index 0000000000000..ba3c7fcfdbb4f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedAllowSameParameterParameter.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun </*0*/ T : jet.Any?>ff(/*0*/ l: java.util.Collection<T>): jet.Boolean diff --git a/compiler/testData/lazyResolve/diagnostics/cast/IsErasedDisallowFromAny.txt b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedDisallowFromAny.txt new file mode 100644 index 0000000000000..4341165e10b6e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedDisallowFromAny.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(/*0*/ l: jet.Any): jet.Boolean diff --git a/compiler/testData/lazyResolve/diagnostics/cast/IsErasedDisallowFromOut.txt b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedDisallowFromOut.txt new file mode 100644 index 0000000000000..3f948ac78062c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedDisallowFromOut.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun f(/*0*/ a: java.util.List<out jet.Any>): jet.Boolean diff --git a/compiler/testData/lazyResolve/diagnostics/cast/IsErasedStar.txt b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedStar.txt new file mode 100644 index 0000000000000..4341165e10b6e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/IsErasedStar.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(/*0*/ l: jet.Any): jet.Boolean diff --git a/compiler/testData/lazyResolve/diagnostics/cast/IsReified.txt b/compiler/testData/lazyResolve/diagnostics/cast/IsReified.txt new file mode 100644 index 0000000000000..2eb32c27524e9 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/IsReified.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class MyList</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): MyList<T> +} +internal final fun ff(/*0*/ a: jet.Any): jet.Boolean diff --git a/compiler/testData/lazyResolve/diagnostics/cast/IsTraits.txt b/compiler/testData/lazyResolve/diagnostics/cast/IsTraits.txt new file mode 100644 index 0000000000000..cfc744366f722 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/IsTraits.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal abstract trait Aaa : jet.Any { +} +internal abstract trait Bbb : jet.Any { +} +internal final fun f(/*0*/ a: Aaa): jet.Boolean diff --git a/compiler/testData/lazyResolve/diagnostics/cast/WhenErasedDisallowFromAny.txt b/compiler/testData/lazyResolve/diagnostics/cast/WhenErasedDisallowFromAny.txt new file mode 100644 index 0000000000000..41ac5a9791844 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/cast/WhenErasedDisallowFromAny.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(/*0*/ l: jet.Any): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/checkArguments/SpreadVarargs.txt b/compiler/testData/lazyResolve/diagnostics/checkArguments/SpreadVarargs.txt new file mode 100644 index 0000000000000..2aede08d6c1eb --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/checkArguments/SpreadVarargs.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final fun </*0*/ T : jet.Any?>array1(/*0*/ vararg a: T /*jet.Array<T>*/): jet.Array<T> +internal final fun join(/*0*/ x: jet.Int, /*1*/ vararg a: jet.String /*jet.Array<jet.String>*/): jet.String +internal final fun </*0*/ T : jet.Any?>joinG(/*0*/ x: jet.Int, /*1*/ vararg a: T /*jet.Array<T>*/): jet.String +internal final fun </*0*/ T : jet.Any?>joinT(/*0*/ x: jet.Int, /*1*/ vararg a: T /*jet.Array<T>*/): T? +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/checkArguments/kt1897_diagnostic_part.txt b/compiler/testData/lazyResolve/diagnostics/checkArguments/kt1897_diagnostic_part.txt new file mode 100644 index 0000000000000..4dfebf0a558c1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/checkArguments/kt1897_diagnostic_part.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final fun bar(): jet.Tuple0 +internal final fun foo(/*0*/ i: jet.Int, /*1*/ s: jet.String): jet.Tuple0 +internal final fun test(): jet.Tuple0 +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/checkArguments/kt1940.txt b/compiler/testData/lazyResolve/diagnostics/checkArguments/kt1940.txt new file mode 100644 index 0000000000000..15fdda13490c4 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/checkArguments/kt1940.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt1940"> +namespace kt1940 + +internal final fun foo(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun test(): jet.Tuple0 +// </namespace name="kt1940"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/checkInnerLocalDeclarations.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/checkInnerLocalDeclarations.txt new file mode 100644 index 0000000000000..d80464c4c00d1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/checkInnerLocalDeclarations.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="c"> +namespace c + +internal final fun test(): jet.Tuple0 +// </namespace name="c"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1001.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1001.txt new file mode 100644 index 0000000000000..9e3be45470a1f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1001.txt @@ -0,0 +1,10 @@ +namespace <root> + +// <namespace name="kt1001"> +namespace kt1001 + +internal final fun doSmth(): jet.Tuple0 +internal final fun foo(/*0*/ c: jet.Array<jet.Int>): jet.Tuple0 +internal final fun t1(): jet.Int +internal final fun t2(): jet.Int +// </namespace name="kt1001"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1027.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1027.txt new file mode 100644 index 0000000000000..19eaec93e3f2c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1027.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt1027"> +namespace kt1027 + +internal final fun doSmth(): jet.Tuple0 +internal final fun foo(/*0*/ c: java.util.List<jet.Int>): jet.Tuple0 +internal final fun t1(): jet.Tuple0 +internal final fun t2(): jet.Tuple0 +internal final fun t3(): jet.Tuple0 +internal final fun t4(): jet.Tuple0 +// </namespace name="kt1027"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1066.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1066.txt new file mode 100644 index 0000000000000..48d46dc10628f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1066.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="kt1066"> +namespace kt1066 + +internal final fun foo(/*0*/ excluded: java.util.Set<jet.Char>): jet.Tuple0 +internal final fun randomDigit(): jet.Char +internal final fun test(): jet.Tuple0 +// </namespace name="kt1066"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1156.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1156.txt new file mode 100644 index 0000000000000..126bba5106df4 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1156.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun foo(/*0*/ maybe: jet.Int?): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1189.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1189.txt new file mode 100644 index 0000000000000..9b42c984facbc --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1189.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt1189"> +namespace kt1189 + +internal final fun foo(): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>java.util.concurrent.locks.ReentrantReadWriteLock.write(/*0*/ action: jet.Function0<T>): T +// </namespace name="kt1189"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1191.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1191.txt new file mode 100644 index 0000000000000..a2866ed58ebff --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1191.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="kt1191"> +namespace kt1191 + +internal abstract trait kt1191.FunctionalList</*0*/ T : jet.Any?> : jet.Any { + internal abstract val head: T + internal abstract val size: jet.Int + internal abstract val tail: kt1191.FunctionalList<T> +} +internal final fun foo(/*0*/ unused: jet.Int): kt1191.foo.<no name provided> +internal final fun </*0*/ T : jet.Any?>kt1191.FunctionalList<T>.plus(/*0*/ element: T): kt1191.FunctionalList<T> +// </namespace name="kt1191"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1219.1301.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1219.1301.txt new file mode 100644 index 0000000000000..c31ca127afced --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1219.1301.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="kt1219"> +namespace kt1219 + +internal final fun </*0*/ T : jet.Any?, /*1*/ R : jet.Any?>jet.Iterable<T>.fold(/*0*/ r: R, /*1*/ op: jet.Function2<T, R, R>): R +internal final fun foo(): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>jet.Iterable<T>.foreach(/*0*/ operation: jet.Function1<T, jet.Tuple0>): jet.Tuple0 +// </namespace name="kt1219"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1571.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1571.txt new file mode 100644 index 0000000000000..6692c4cefc94a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1571.txt @@ -0,0 +1,17 @@ +namespace <root> + +// <namespace name="kt1571"> +namespace kt1571 + +internal final class kt1571.A : jet.Any { + public final /*constructor*/ fun <init>(): kt1571.A + internal final fun divAssign(/*0*/ a: jet.Int): jet.Tuple0 + internal final var p: jet.Int + internal final fun times(/*0*/ a: jet.Int): kt1571.A +} +internal final val a: kt1571.A +internal final var c0: jet.Int +internal final var c1: jet.Int +internal final var c2: jet.Int +internal final fun box(): jet.String +// </namespace name="kt1571"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1977.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1977.txt new file mode 100644 index 0000000000000..83e25d8c5b42e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt1977.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="kt1977"> +namespace kt1977 + +internal final fun bar(): jet.Tuple0 +internal final fun foo(): jet.Tuple0 +internal final fun strToInt(/*0*/ s: jet.String): jet.Int? +internal final fun test1(/*0*/ s: jet.String): jet.Int? +internal final fun test2(/*0*/ s: jet.String): jet.Int? +// </namespace name="kt1977"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt2166_kt2103.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt2166_kt2103.txt new file mode 100644 index 0000000000000..7fa5bdcf469a0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt2166_kt2103.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final fun bar(): jet.Boolean +internal final fun foo(): jet.Int +internal final fun foo1(): jet.Boolean +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt2226.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt2226.txt new file mode 100644 index 0000000000000..8bb79a4d58fd5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt2226.txt @@ -0,0 +1,14 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal abstract trait a.A : jet.Any { + internal abstract fun foo(): jet.Int +} +internal final class a.B : a.A { + public final /*constructor*/ fun <init>(): a.B + internal open override /*1*/ fun foo(): jet.Int +} +internal final fun foo(/*0*/ b: a.B): jet.Int +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt510.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt510.txt new file mode 100644 index 0000000000000..fb0fa3888bc8b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt510.txt @@ -0,0 +1,14 @@ +namespace <root> + +// <namespace name="kt510"> +namespace kt510 + +public open class kt510.Identifier1 : jet.Any { + public final /*constructor*/ fun <init>(): kt510.Identifier1 + internal final var field: jet.Boolean +} +public open class kt510.Identifier2 : jet.Any { + public final /*constructor*/ fun <init>(): kt510.Identifier2 + internal final var field: jet.Boolean +} +// </namespace name="kt510"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt607.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt607.txt new file mode 100644 index 0000000000000..9515d48ad61a9 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt607.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="kt607"> +namespace kt607 + +internal final class kt607.A : jet.Any { + public final /*constructor*/ fun <init>(): kt607.A + internal final val z: jet.Int +} +internal final fun foo(/*0*/ a: kt607.A): jet.Tuple0 +// </namespace name="kt607"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt609.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt609.txt new file mode 100644 index 0000000000000..1b4744bef6847 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt609.txt @@ -0,0 +1,19 @@ +namespace <root> + +// <namespace name="kt609"> +namespace kt609 + +internal open class kt609.A : jet.Any { + public final /*constructor*/ fun <init>(): kt609.A + internal open fun foo(/*0*/ s: jet.String): jet.Tuple0 +} +internal final class kt609.B : kt609.A { + public final /*constructor*/ fun <init>(): kt609.B + internal final override /*1*/ fun foo(/*0*/ s: jet.String): jet.Tuple0 +} +internal final class kt609.C : jet.Any { + public final /*constructor*/ fun <init>(): kt609.C + internal final fun foo(/*0*/ s: jet.String): jet.Tuple0 +} +internal final fun test(/*0*/ a: jet.Int): jet.Tuple0 +// </namespace name="kt609"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt610.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt610.txt new file mode 100644 index 0000000000000..7a6b92e126d7f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt610.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kt610"> +namespace kt610 + +internal final fun foo(): jet.Tuple0 +// </namespace name="kt610"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt776.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt776.txt new file mode 100644 index 0000000000000..71633ff4143c0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt776.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="kt776"> +namespace kt776 + +internal final fun doSmth(): jet.Tuple0 +internal final fun test1(): jet.Int +internal final fun test5(): jet.Int +// </namespace name="kt776"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt843.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt843.txt new file mode 100644 index 0000000000000..87c51c79675d0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt843.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kt843"> +namespace kt843 + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="kt843"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt897.txt b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt897.txt new file mode 100644 index 0000000000000..1976dac959d5a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlFlowAnalysis/kt897.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt897"> +namespace kt897 + +internal final class kt897.A : jet.Any { + public final /*constructor*/ fun <init>(): kt897.A + internal final val i: jet.Int? + internal final var j: jet.Int + internal final val k: jet.Int +} +// </namespace name="kt897"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlStructures/ForWithoutBraces.txt b/compiler/testData/lazyResolve/diagnostics/controlStructures/ForWithoutBraces.txt new file mode 100644 index 0000000000000..4b34c64649ab4 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlStructures/ForWithoutBraces.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/controlStructures/kt1075.txt b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt1075.txt new file mode 100644 index 0000000000000..c2f1c60e2241d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt1075.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kt1075"> +namespace kt1075 + +internal final fun foo(/*0*/ b: jet.String): jet.Tuple0 +// </namespace name="kt1075"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlStructures/kt657.txt b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt657.txt new file mode 100644 index 0000000000000..c6f81f06bd6fa --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt657.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="kt657"> +namespace kt657 + +internal final fun cond1(): jet.Boolean +internal final fun cond2(): jet.Boolean +internal final fun foo(): jet.Int +// </namespace name="kt657"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlStructures/kt770.kt351.kt735_StatementType.txt b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt770.kt351.kt735_StatementType.txt new file mode 100644 index 0000000000000..7558477069c93 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt770.kt351.kt735_StatementType.txt @@ -0,0 +1,18 @@ +namespace <root> + +// <namespace name="kt770_351_735"> +namespace kt770_351_735 + +internal final val w: [ERROR : Type for while (true) {}] +internal final fun bar(/*0*/ a: jet.Tuple0): jet.Tuple0 +internal final fun box(): jet.Int +internal final fun doSmth(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun foo(): jet.Tuple0 +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun test1(): jet.Tuple0 +internal final fun test2(): jet.Tuple0 +internal final fun testCoercionToUnit(): jet.Tuple0 +internal final fun testImplicitCoercion(): jet.Tuple0 +internal final fun testStatementInExpressionContext(): jet.Tuple0 +internal final fun testStatementInExpressionContext2(): jet.Tuple0 +// </namespace name="kt770_351_735"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlStructures/kt786.txt b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt786.txt new file mode 100644 index 0000000000000..d8b1d7b1252b4 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt786.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="kt786"> +namespace kt786 + +internal final fun bar(): jet.Int +internal final fun fff(): jet.Int +internal final fun foo(): jet.Int +// </namespace name="kt786"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlStructures/kt799.txt b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt799.txt new file mode 100644 index 0000000000000..5fc1c2a661e79 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlStructures/kt799.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt799"> +namespace kt799 + +internal final val a: jet.Nothing +internal final val b: jet.Nothing +internal final val c: jet.Tuple0 +internal final fun doSmth(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun f(/*0*/ mi: jet.Int = ?): jet.Tuple0 +internal final fun test(): jet.Tuple0 +// </namespace name="kt799"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlStructures/tryReturnType.txt b/compiler/testData/lazyResolve/diagnostics/controlStructures/tryReturnType.txt new file mode 100644 index 0000000000000..a251051b5f200 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlStructures/tryReturnType.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final fun bar(): jet.Int +internal final fun doSmth(): jet.Tuple0 +internal final fun foo(): jet.Int +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/controlStructures/when.kt234.kt973.txt b/compiler/testData/lazyResolve/diagnostics/controlStructures/when.kt234.kt973.txt new file mode 100644 index 0000000000000..ee3bfcd083797 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/controlStructures/when.kt234.kt973.txt @@ -0,0 +1,15 @@ +namespace <root> + +// <namespace name="kt234_kt973"> +namespace kt234_kt973 + +internal final fun foo3(/*0*/ x: jet.Int): jet.Int +internal final fun foo4(/*0*/ x: jet.Int): jet.Int +internal final fun t1(/*0*/ x: jet.Int): jet.Int +internal final fun t2(/*0*/ x: jet.Int): jet.Int +internal final fun t3(/*0*/ x: jet.Int): jet.Int +internal final fun t4(/*0*/ x: jet.Int): jet.Int +internal final fun t5(/*0*/ x: jet.Int): jet.Int +internal final fun test(/*0*/ t: jet.Tuple2<out jet.Int, out jet.Int>): jet.Int +internal final fun test1(/*0*/ t: jet.Tuple2<out jet.Int, out jet.Int>): jet.Int +// </namespace name="kt234_kt973"> diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlow/CalleeExpression.txt b/compiler/testData/lazyResolve/diagnostics/dataFlow/CalleeExpression.txt new file mode 100644 index 0000000000000..ce49ca5e9f829 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlow/CalleeExpression.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class C : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ f: jet.Function0<jet.Tuple0>): C + internal final val f: jet.Function0<jet.Tuple0> +} +internal final fun test(/*0*/ e: jet.Any): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlow/TupleExpression.txt b/compiler/testData/lazyResolve/diagnostics/dataFlow/TupleExpression.txt new file mode 100644 index 0000000000000..793a6551f3e1d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlow/TupleExpression.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class C : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ f: jet.Int): C + internal final val f: jet.Int +} +internal final fun test(/*0*/ e: jet.Any): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlow/WhenSubject.txt b/compiler/testData/lazyResolve/diagnostics/dataFlow/WhenSubject.txt new file mode 100644 index 0000000000000..1f96cc7fb1d72 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlow/WhenSubject.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal final class BinOp : Expr { + public final /*constructor*/ fun <init>(/*0*/ operator: jet.String): BinOp + internal final val operator: jet.String +} +internal abstract trait Expr : jet.Any { +} +internal final fun test(/*0*/ e: Expr): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/AndOr.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/AndOr.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/AndOr.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ArrayAccess.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ArrayAccess.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ArrayAccess.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/BinaryExpression.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/BinaryExpression.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/BinaryExpression.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/DeepIf.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/DeepIf.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/DeepIf.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/DoWhile.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/DoWhile.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/DoWhile.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Elvis.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Elvis.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Elvis.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ExclExcl.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ExclExcl.txt new file mode 100644 index 0000000000000..9af818d67606b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ExclExcl.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun f1(/*0*/ x: jet.Int?): jet.Tuple0 +internal final fun f2(/*0*/ x: jet.Int?): jet.Tuple0 +internal final fun f3(/*0*/ x: jet.Int?): jet.Tuple0 +internal final fun f4(/*0*/ x: jet.Int?): jet.Tuple0 +internal final fun f5(/*0*/ x: jet.Int?): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/For.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/For.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/For.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/FunctionLiteral.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/FunctionLiteral.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/FunctionLiteral.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/IfThenElse.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/IfThenElse.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/IfThenElse.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/IfThenElseBothInvalid.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/IfThenElseBothInvalid.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/IfThenElseBothInvalid.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ObjectExpression.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ObjectExpression.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ObjectExpression.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/QualifiedExpression.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/QualifiedExpression.txt new file mode 100644 index 0000000000000..1794133d26608 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/QualifiedExpression.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final fun bar(/*0*/ x: jet.Int): jet.Int +} +internal final fun baz(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Return.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Return.txt new file mode 100644 index 0000000000000..b1c73ed1c32df --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Return.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ThisSuper.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ThisSuper.txt new file mode 100644 index 0000000000000..314550ba790ea --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/ThisSuper.txt @@ -0,0 +1,12 @@ +namespace <root> + +internal open class Base : jet.Any { + public final /*constructor*/ fun <init>(): Base + internal final fun bar(/*0*/ x: jet.Int): jet.Int +} +internal final class Derived : Base { + public final /*constructor*/ fun <init>(): Derived + internal final override /*1*/ fun bar(/*0*/ x: jet.Int): jet.Int + internal final fun baz(/*0*/ x: jet.Int): jet.Int + internal final fun foo(): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Throw.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Throw.txt new file mode 100644 index 0000000000000..12260238f47c4 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/Throw.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): java.lang.RuntimeException +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/TryCatch.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/TryCatch.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/TryCatch.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/UnaryExpression.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/UnaryExpression.txt new file mode 100644 index 0000000000000..11a348b2d0177 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/UnaryExpression.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun baz(/*0*/ b: jet.Boolean): jet.Boolean +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/When.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/When.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/When.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/While.txt b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/While.txt new file mode 100644 index 0000000000000..d9da81d482b1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/dataFlowInfoTraversal/While.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun bar(/*0*/ x: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt1141.txt b/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt1141.txt new file mode 100644 index 0000000000000..ac30d56821411 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt1141.txt @@ -0,0 +1,16 @@ +namespace <root> + +// <namespace name="kt1141"> +namespace kt1141 + +internal final class kt1141.C : kt1141.SomeTrait { + public final /*constructor*/ fun <init>(): kt1141.C + internal abstract override /*1*/ fun foo(): jet.Tuple0 +} +public abstract trait kt1141.SomeTrait : jet.Any { + internal abstract fun foo(): jet.Tuple0 +} +internal final val Rr: kt1141.Rr +internal final fun foo(): jet.Tuple0 +internal final fun foo2(): jet.Tuple0 +// </namespace name="kt1141"> diff --git a/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt2096.txt b/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt2096.txt new file mode 100644 index 0000000000000..ad7d211adaa89 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt2096.txt @@ -0,0 +1,10 @@ +namespace <root> + +// <namespace name="c"> +namespace c + +internal abstract class c.Foo : jet.Any { + public final /*constructor*/ fun <init>(): c.Foo + protected abstract val prop: [ERROR : No type, no body] +} +// </namespace name="c"> diff --git a/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt2142.txt b/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt2142.txt new file mode 100644 index 0000000000000..f09c4dce1a220 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt2142.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final fun foo(): jet.Tuple0 +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt559.txt b/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt559.txt new file mode 100644 index 0000000000000..0426640aa1697 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/declarationChecks/kt559.txt @@ -0,0 +1,31 @@ +namespace <root> + +// <namespace name="kt559"> +namespace kt559 + +internal abstract class kt559.A : jet.Any { + public final /*constructor*/ fun <init>(): kt559.A + internal final fun fff(): jet.Tuple0 + internal abstract fun foo(): jet.Int + internal abstract val i: jet.Int +} +internal final class kt559.B : kt559.A { + public final /*constructor*/ fun <init>(): kt559.B + internal final override /*1*/ fun fff(): jet.Tuple0 + internal open override /*1*/ fun foo(): jet.Int + internal abstract override /*1*/ val i: jet.Int +} +internal final class kt559.C : kt559.D { + public final /*constructor*/ fun <init>(): kt559.C + internal final override /*1*/ fun fff(): jet.Tuple0 + internal abstract override /*1*/ fun foo(): jet.Int + internal open override /*1*/ val i: jet.Int + internal final fun test(): jet.Tuple0 +} +internal abstract class kt559.D : kt559.A { + public final /*constructor*/ fun <init>(): kt559.D + internal final override /*1*/ fun fff(): jet.Tuple0 + internal abstract override /*1*/ fun foo(): jet.Int + internal open override /*1*/ val i: jet.Int +} +// </namespace name="kt559"> diff --git a/compiler/testData/lazyResolve/diagnostics/extensions/ExtensionFunctions.txt b/compiler/testData/lazyResolve/diagnostics/extensions/ExtensionFunctions.txt new file mode 100644 index 0000000000000..d65323c776003 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/extensions/ExtensionFunctions.txt @@ -0,0 +1,32 @@ +namespace <root> + +// <namespace name="outer"> +namespace outer + +internal final class outer.A : jet.Any { + public final /*constructor*/ fun <init>(): outer.A +} +internal final val jet.Int.abs: jet.Int +internal final val </*0*/ T : jet.Any?> T.foo: T +internal final val jet.Int?.optval: jet.Tuple0 +internal final fun </*0*/ T : jet.Any?, /*1*/ E : jet.Any?>T.foo(/*0*/ x: E, /*1*/ y: outer.A): T +internal final fun jet.Int.foo(): jet.Int +internal final fun </*0*/ T : jet.Any?>T.minus(/*0*/ t: T): jet.Int +internal final fun jet.Int?.optint(): jet.Tuple0 +internal final fun outer.A.plus(/*0*/ a: jet.Any): jet.Tuple0 +internal final fun outer.A.plus(/*0*/ a: jet.Int): jet.Tuple0 +internal final fun test(): jet.Tuple0 +// </namespace name="outer"> +// <namespace name="null_safety"> +namespace null_safety + +internal final class null_safety.Command : jet.Any { + public final /*constructor*/ fun <init>(): null_safety.Command + internal final val foo: jet.Int +} +internal final fun jet.Any.equals(/*0*/ other: jet.Any?): jet.Boolean +internal final fun jet.Any?.equals1(/*0*/ other: jet.Any?): jet.Boolean +internal final fun jet.Any.equals2(/*0*/ other: jet.Any?): jet.Boolean +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun parse(/*0*/ cmd: jet.String): null_safety.Command? +// </namespace name="null_safety"> diff --git a/compiler/testData/lazyResolve/diagnostics/extensions/ExtensionsCalledOnSuper.txt b/compiler/testData/lazyResolve/diagnostics/extensions/ExtensionsCalledOnSuper.txt new file mode 100644 index 0000000000000..3650673a33a29 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/extensions/ExtensionsCalledOnSuper.txt @@ -0,0 +1,17 @@ +namespace <root> + +internal final class C : T { + public final /*constructor*/ fun <init>(): C + internal open override /*1*/ fun buzz(): jet.Tuple0 + internal open override /*1*/ fun buzz1(/*0*/ i: jet.Int): jet.Tuple0 + internal open override /*1*/ fun foo(): jet.Tuple0 + internal final fun test(): jet.Tuple0 +} +internal abstract trait T : jet.Any { + internal open fun buzz(): jet.Tuple0 + internal open fun buzz1(/*0*/ i: jet.Int): jet.Tuple0 + internal open fun foo(): jet.Tuple0 +} +internal final fun T.bar(): jet.Tuple0 +internal final fun T.buzz(): jet.Tuple0 +internal final fun T.buzz1(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/extensions/GenericIterator.txt b/compiler/testData/lazyResolve/diagnostics/extensions/GenericIterator.txt new file mode 100644 index 0000000000000..f173ad02b8f87 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/extensions/GenericIterator.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun </*0*/ T : jet.Any>T?.iterator(): iterator.<no name provided> +internal final fun </*0*/ T : jet.Any?>java.util.Enumeration<T>.iterator(): iterator.<no name provided> +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/extensions/GenericIterator2.txt b/compiler/testData/lazyResolve/diagnostics/extensions/GenericIterator2.txt new file mode 100644 index 0000000000000..b4ec6b67f35e9 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/extensions/GenericIterator2.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun a(/*0*/ e: java.util.Enumeration<jet.Int>): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>java.util.Enumeration<T>.iterator(): iterator.<no name provided> diff --git a/compiler/testData/lazyResolve/diagnostics/extensions/kt1875.txt b/compiler/testData/lazyResolve/diagnostics/extensions/kt1875.txt new file mode 100644 index 0000000000000..2e03bdb4152cc --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/extensions/kt1875.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt1875"> +namespace kt1875 + +internal abstract trait kt1875.T : jet.Any { + internal abstract val f: jet.Function1<jet.Int, jet.Tuple0>? +} +internal final fun f(/*0*/ a: jet.Int?, /*1*/ b: jet.ExtensionFunction1<jet.Int, jet.Int, jet.Int>): jet.Int? +internal final fun test(/*0*/ t: kt1875.T): jet.Tuple0 +internal final fun test1(/*0*/ t: kt1875.T?): jet.Tuple0 +// </namespace name="kt1875"> diff --git a/compiler/testData/lazyResolve/diagnostics/extensions/kt2317.txt b/compiler/testData/lazyResolve/diagnostics/extensions/kt2317.txt new file mode 100644 index 0000000000000..f73a9f2c24f3d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/extensions/kt2317.txt @@ -0,0 +1,10 @@ +namespace <root> + +// <namespace name="kt2317"> +namespace kt2317 + +internal final fun jet.Any?.bar(): jet.Tuple0 +internal final fun jet.Any?.baz(): jet.Int +internal final fun foo(/*0*/ l: jet.Long?): jet.Int? +internal final fun quux(/*0*/ x: jet.Int?): jet.Tuple0 +// </namespace name="kt2317"> diff --git a/compiler/testData/lazyResolve/diagnostics/extensions/kt819ExtensionProperties.txt b/compiler/testData/lazyResolve/diagnostics/extensions/kt819ExtensionProperties.txt new file mode 100644 index 0000000000000..877ed049f4dab --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/extensions/kt819ExtensionProperties.txt @@ -0,0 +1,19 @@ +namespace <root> + +internal open class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal open fun jet.Int.foo(): jet.Tuple0 + internal open val jet.Int.foo: jet.Int + internal open fun jet.String.foo(): jet.Tuple0 + internal open val jet.String.foo: jet.Int +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal open override /*1*/ fun jet.Int.foo(): jet.Tuple0 + internal open override /*1*/ val jet.Int.foo: jet.Int + internal open override /*1*/ fun jet.String.foo(): jet.Tuple0 + internal open override /*1*/ val jet.String.foo: jet.Int + internal final fun use(/*0*/ s: jet.String): jet.Tuple0 +} +internal final val java.io.InputStream.buffered: java.io.BufferedInputStream +internal final val java.io.Reader.buffered: java.io.BufferedReader diff --git a/compiler/testData/lazyResolve/diagnostics/generics/Projections.txt b/compiler/testData/lazyResolve/diagnostics/generics/Projections.txt new file mode 100644 index 0000000000000..a323465fdb0ce --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/generics/Projections.txt @@ -0,0 +1,20 @@ +namespace <root> + +internal final class In</*0*/ in T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ in T : jet.Any?><init>(): In<T> + internal final fun f(/*0*/ t: T): jet.Tuple0 + internal final fun f(/*0*/ t: jet.Int): jet.Int + internal final fun f1(/*0*/ t: T): jet.Tuple0 +} +internal final class Inv</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): Inv<T> + internal final fun f(/*0*/ t: T): T + internal final fun inf(/*0*/ t: T): jet.Tuple0 + internal final fun outf(): T +} +internal final class Out</*0*/ out T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ out T : jet.Any?><init>(): Out<T> + internal final fun f(): T + internal final fun f(/*0*/ a: jet.Int): jet.Int +} +internal final fun testInOut(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/generics/RecursiveUpperBoundCheck.txt b/compiler/testData/lazyResolve/diagnostics/generics/RecursiveUpperBoundCheck.txt new file mode 100644 index 0000000000000..a6c9123ef914a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/generics/RecursiveUpperBoundCheck.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal open class C</*0*/ T : C<T>> : jet.Any { + public final /*constructor*/ fun </*0*/ T : C<T>><init>(): C<T> +} +internal final class TestFail : C<C<TestFail>> { + public final /*constructor*/ fun <init>(): TestFail +} +internal final class TestOK : C<TestOK> { + public final /*constructor*/ fun <init>(): TestOK +} diff --git a/compiler/testData/lazyResolve/diagnostics/generics/RecursiveUpperBoundWithTwoArguments.txt b/compiler/testData/lazyResolve/diagnostics/generics/RecursiveUpperBoundWithTwoArguments.txt new file mode 100644 index 0000000000000..94876dfa4ca1b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/generics/RecursiveUpperBoundWithTwoArguments.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final class D</*0*/ A : D<A, jet.String>, /*1*/ B : D<A, B>> : jet.Any { + public final /*constructor*/ fun </*0*/ A : D<A, jet.String>, /*1*/ B : D<A, B>><init>(): D<A, B> +} diff --git a/compiler/testData/lazyResolve/diagnostics/generics/kt1575-Class.txt b/compiler/testData/lazyResolve/diagnostics/generics/kt1575-Class.txt new file mode 100644 index 0000000000000..f6f869157ef13 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/generics/kt1575-Class.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final class C</*0*/ T : C<T>> : jet.Any { + public final /*constructor*/ fun </*0*/ T : C<T>><init>(): C<T> +} diff --git a/compiler/testData/lazyResolve/diagnostics/generics/kt1575-ClassObject.txt b/compiler/testData/lazyResolve/diagnostics/generics/kt1575-ClassObject.txt new file mode 100644 index 0000000000000..5afc6944ac6e6 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/generics/kt1575-ClassObject.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final class CO</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): CO<T> +} diff --git a/compiler/testData/lazyResolve/diagnostics/generics/kt1575-Function.txt b/compiler/testData/lazyResolve/diagnostics/generics/kt1575-Function.txt new file mode 100644 index 0000000000000..42516ea3bdc97 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/generics/kt1575-Function.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class C</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): C<T> +} +internal final fun </*0*/ T : C<T>>foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/arrayBracketsRange.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/arrayBracketsRange.txt new file mode 100644 index 0000000000000..95c1f1a60ff5e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/arrayBracketsRange.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="b"> +namespace b + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="b"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/checkBackingFieldException.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/checkBackingFieldException.txt new file mode 100644 index 0000000000000..267fa8fd9bcc3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/checkBackingFieldException.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="h"> +namespace h + +internal final class h.Square : jet.Any { + public final /*constructor*/ fun <init>(): h.Square + internal final var area: jet.Double private set + internal final var size: jet.Double +} +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="h"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/funEquals.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/funEquals.txt new file mode 100644 index 0000000000000..3ed5be51eb58d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/funEquals.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun foo(): [ERROR : No type, no body] diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteVal.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteVal.txt new file mode 100644 index 0000000000000..e0371f27491df --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteVal.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="c"> +namespace c + +internal final val i: [ERROR : No type, no body] +// </namespace name="c"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteValWithAccessor.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteValWithAccessor.txt new file mode 100644 index 0000000000000..151368993ca6d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteValWithAccessor.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="c"> +namespace c + +internal final val i: jet.String +// </namespace name="c"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.txt new file mode 100644 index 0000000000000..bc2eac646d41d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(/*0*/ a: jet.Any): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/namedFun.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/namedFun.txt new file mode 100644 index 0000000000000..6789f8ae8f80f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/diagnosticWithSyntaxError/namedFun.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun bar(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/incompleteAssignment.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/incompleteAssignment.txt new file mode 100644 index 0000000000000..07e455fd78a4a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/incompleteAssignment.txt @@ -0,0 +1,10 @@ +namespace <root> + +// <namespace name="sum"> +namespace sum + +internal final fun </*0*/ T : jet.Any?>assertEquals(/*0*/ actual: T?, /*1*/ expected: T?, /*2*/ message: jet.Any? = ?): jet.Tuple0 +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun sum(/*0*/ a: jet.IntArray): jet.Int +internal final fun test(/*0*/ expectedSum: jet.Int, /*1*/ vararg data: jet.Int /*jet.IntArray*/): jet.Tuple0 +// </namespace name="sum"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/kt1955.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/kt1955.txt new file mode 100644 index 0000000000000..ca6901ec7cba0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/kt1955.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="b"> +namespace b + +internal final fun foo(): jet.Tuple0 +// </namespace name="b"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/kt2014.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/kt2014.txt new file mode 100644 index 0000000000000..3b79ea2e6dc75 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/kt2014.txt @@ -0,0 +1,14 @@ +namespace <root> + +// <namespace name="c"> +namespace c + +internal final class c.Foo : jet.Any { + public final /*constructor*/ fun <init>(): c.Foo + internal final val a: jet.Int + internal final fun bar(/*0*/ i: jet.Int): jet.Int + internal final fun prop(): jet.Int +} +internal final val R: c.R +internal final fun x(/*0*/ f: c.Foo): jet.Tuple0 +// </namespace name="c"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/plusOnTheRight.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/plusOnTheRight.txt new file mode 100644 index 0000000000000..3a36d1927325f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/plusOnTheRight.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final class a.MyClass1 : jet.Any { + public final /*constructor*/ fun <init>(): a.MyClass1 + public final fun plus(): jet.Tuple0 +} +internal final fun main(/*0*/ arg: a.MyClass1): jet.Tuple0 +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/pseudocodeTraverseNextInstructions.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/pseudocodeTraverseNextInstructions.txt new file mode 100644 index 0000000000000..ca6901ec7cba0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/pseudocodeTraverseNextInstructions.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="b"> +namespace b + +internal final fun foo(): jet.Tuple0 +// </namespace name="b"> diff --git a/compiler/testData/lazyResolve/diagnostics/incompleteCode/senselessComparisonWithNull.txt b/compiler/testData/lazyResolve/diagnostics/incompleteCode/senselessComparisonWithNull.txt new file mode 100644 index 0000000000000..0bcc99a0c816e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/incompleteCode/senselessComparisonWithNull.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="d"> +namespace d + +internal final fun foo(/*0*/ a: jet.IntArray): jet.Tuple0 +// </namespace name="d"> diff --git a/compiler/testData/lazyResolve/diagnostics/inference/NoInferenceFromDeclaredBounds.txt b/compiler/testData/lazyResolve/diagnostics/inference/NoInferenceFromDeclaredBounds.txt new file mode 100644 index 0000000000000..3ee17563fd3fb --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/inference/NoInferenceFromDeclaredBounds.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final val n: jet.Nothing +internal final fun foo1(): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>fooT22(): T? diff --git a/compiler/testData/lazyResolve/diagnostics/inference/kt1293.txt b/compiler/testData/lazyResolve/diagnostics/inference/kt1293.txt new file mode 100644 index 0000000000000..53a80612617f8 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/inference/kt1293.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt1293"> +namespace kt1293 + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun requiresInt(/*0*/ i: jet.Int): jet.Tuple0 +// </namespace name="kt1293"> diff --git a/compiler/testData/lazyResolve/diagnostics/infos/Autocasts.txt b/compiler/testData/lazyResolve/diagnostics/infos/Autocasts.txt new file mode 100644 index 0000000000000..cb71a027ad8e5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/infos/Autocasts.txt @@ -0,0 +1,38 @@ +namespace <root> + +internal open class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final fun foo(): jet.Tuple0 +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal final fun bar(): jet.Tuple0 + internal final override /*1*/ fun foo(): jet.Tuple0 +} +internal final class C : A { + public final /*constructor*/ fun <init>(): C + internal final fun bar(): jet.Tuple0 + internal final override /*1*/ fun foo(): jet.Tuple0 +} +internal final fun declarationInsidePattern(/*0*/ x: jet.Tuple2<out jet.Any, out jet.Any>): jet.String +internal final fun declarations(/*0*/ a: jet.Any?): jet.Tuple0 +internal final fun f(): jet.String +internal final fun f10(/*0*/ init: A?): jet.Tuple0 +internal final fun f101(/*0*/ a: A?): jet.Tuple0 +internal final fun f11(/*0*/ a: A?): jet.Tuple0 +internal final fun f12(/*0*/ a: A?): jet.Tuple0 +internal final fun f13(/*0*/ a: A?): jet.Tuple0 +internal final fun f14(/*0*/ a: A?): jet.Tuple0 +internal final fun f15(/*0*/ a: A?): jet.Tuple0 +internal final fun f9(/*0*/ init: A?): jet.Tuple0 +internal final fun foo(/*0*/ a: jet.Any): jet.Int +internal final fun getStringLength(/*0*/ obj: jet.Any): jet.Char? +internal final fun illegalTupleReturnType(/*0*/ a: jet.Any): jet.Tuple2<out jet.Any, out jet.String> +internal final fun illegalWhenBlock(/*0*/ a: jet.Any): jet.Int +internal final fun illegalWhenBody(/*0*/ a: jet.Any): jet.Int +internal final fun mergeAutocasts(/*0*/ a: jet.Any?): jet.Tuple0 +internal final fun returnFunctionLiteral(/*0*/ a: jet.Any?): jet.Function0<jet.Int> +internal final fun returnFunctionLiteralBlock(/*0*/ a: jet.Any?): jet.Function0<jet.Int> +internal final fun toInt(/*0*/ i: jet.Int?): jet.Int +internal final fun tuples(/*0*/ a: jet.Any?): jet.Tuple0 +internal final fun vars(/*0*/ a: jet.Any?): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/infos/PropertiesWithBackingFields.txt b/compiler/testData/lazyResolve/diagnostics/infos/PropertiesWithBackingFields.txt new file mode 100644 index 0000000000000..d1c732f4f13e0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/infos/PropertiesWithBackingFields.txt @@ -0,0 +1,46 @@ +namespace <root> + +internal open class Super : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ i: jet.Int): Super +} +internal abstract class Test : jet.Any { + public final /*constructor*/ fun <init>(): Test + internal final val a: jet.Int + internal final val b: jet.Int + internal final val c1: jet.Int + internal final val c2: jet.Int + internal final val c3: jet.Int + internal final val c4: jet.Int + internal final val c5: jet.Int + internal final val c: jet.Int + internal final var v10: jet.Int + internal abstract val v11: jet.Int + internal abstract var v12: jet.Int + internal final var v1: jet.Int + internal final var v2: jet.Int + internal final var v3: jet.Int + internal final var v4: jet.Int + internal final var v5: jet.Int + internal final var v6: jet.Int + internal abstract val v7: jet.Int + internal abstract var v8: jet.Int + internal final var v9: jet.Int + internal final var v: jet.Int + internal abstract val x1: jet.Int + internal abstract val x2: jet.Int + internal abstract val x: jet.Int + internal abstract var y1: jet.Int + internal abstract var y2: jet.Int + internal abstract var y3: jet.Int + internal abstract var y4: jet.Int + internal abstract var y5: jet.Int + internal abstract var y6: jet.Int + internal abstract var y: jet.Int +} +internal final class TestPCParameters : Super { + public final /*constructor*/ fun <init>(/*0*/ w: jet.Int, /*1*/ x: jet.Int, /*2*/ y: jet.Int, /*3*/ z: jet.Int): TestPCParameters + internal final fun foo(): [ERROR : Error function type] + internal final val xx: jet.Int + internal final val y: jet.Int + internal final var z: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/j+k/OverrideVararg.txt b/compiler/testData/lazyResolve/diagnostics/j+k/OverrideVararg.txt new file mode 100644 index 0000000000000..189d3c78eadc7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/j+k/OverrideVararg.txt @@ -0,0 +1,10 @@ +namespace <root> + +public abstract class Aaa : java.lang.Object { + public final /*constructor*/ fun <init>(): Aaa + public abstract fun foo(/*0*/ vararg args: jet.String? /*jet.Array<jet.String?>*/): jet.Tuple0 +} +internal final class Bbb : Aaa { + public final /*constructor*/ fun <init>(): Bbb + public open override /*1*/ fun foo(/*0*/ vararg args: jet.String? /*jet.Array<jet.String?>*/): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/j+k/StaticMembersFromSuperclasses.txt b/compiler/testData/lazyResolve/diagnostics/j+k/StaticMembersFromSuperclasses.txt new file mode 100644 index 0000000000000..57726bf42fcf7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/j+k/StaticMembersFromSuperclasses.txt @@ -0,0 +1,9 @@ +namespace <root> + +public open class Aaa : java.lang.Object { + public final /*constructor*/ fun <init>(): Aaa +} +public open class Bbb : Aaa { + public final /*constructor*/ fun <init>(): Bbb +} +internal final fun foo(): jet.String diff --git a/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-NotNull-SpecialTypes.txt b/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-NotNull-SpecialTypes.txt new file mode 100644 index 0000000000000..e6e67c4233ef3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-NotNull-SpecialTypes.txt @@ -0,0 +1,16 @@ +namespace <root> + +public open class A : java.lang.Object { + public final /*constructor*/ fun <init>(): A +} +public open class X</*0*/ T : jet.Any?> : java.lang.Object { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): X<T> + package open fun barN(/*0*/ a: T): jet.Tuple0 + package open fun fooN(): T +} +public open class Y : X<jet.String> { + public final /*constructor*/ fun <init>(): Y + package open override /*1*/ fun barN(/*0*/ a: jet.String): jet.Tuple0 + package open override /*1*/ fun fooN(): jet.String +} +internal final fun main(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-NotNull-UserTypes.txt b/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-NotNull-UserTypes.txt new file mode 100644 index 0000000000000..22612bdce8418 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-NotNull-UserTypes.txt @@ -0,0 +1,16 @@ +namespace <root> + +public open class A : java.lang.Object { + public final /*constructor*/ fun <init>(): A +} +public open class X</*0*/ T : jet.Any?> : java.lang.Object { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): X<T> + package open fun barN(/*0*/ a: T): jet.Tuple0 + package open fun fooN(): T +} +public open class Y : X<A> { + public final /*constructor*/ fun <init>(): Y + package open override /*1*/ fun barN(/*0*/ a: A): jet.Tuple0 + package open override /*1*/ fun fooN(): A +} +internal final fun main(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-SpecialTypes.txt b/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-SpecialTypes.txt new file mode 100644 index 0000000000000..06d09f0466b3d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-SpecialTypes.txt @@ -0,0 +1,16 @@ +namespace <root> + +public open class A : java.lang.Object { + public final /*constructor*/ fun <init>(): A +} +public open class X</*0*/ T : jet.Any?> : java.lang.Object { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): X<T> + package open fun bar(/*0*/ a: T?): jet.Tuple0 + package open fun foo(): T? +} +public open class Y : X<jet.String> { + public final /*constructor*/ fun <init>(): Y + package open override /*1*/ fun bar(/*0*/ a: jet.String?): jet.Tuple0 + package open override /*1*/ fun foo(): jet.String? +} +internal final fun main(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-UserTypes.txt b/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-UserTypes.txt new file mode 100644 index 0000000000000..c0645c7f2224a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/j+k/SupertypeArgumentsNullability-UserTypes.txt @@ -0,0 +1,16 @@ +namespace <root> + +public open class A : java.lang.Object { + public final /*constructor*/ fun <init>(): A +} +public open class X</*0*/ T : jet.Any?> : java.lang.Object { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): X<T> + package open fun bar(/*0*/ a: T?): jet.Tuple0 + package open fun foo(): T? +} +public open class Y : X<A> { + public final /*constructor*/ fun <init>(): Y + package open override /*1*/ fun bar(/*0*/ a: A?): jet.Tuple0 + package open override /*1*/ fun foo(): A? +} +internal final fun main(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListAndMap.txt b/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListAndMap.txt new file mode 100644 index 0000000000000..0aad809dfb8b1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListAndMap.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kotlin1"> +namespace kotlin1 + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun test(/*0*/ a: java.util.List<jet.Int>, /*1*/ m: java.util.Map<jet.String, jet.Int>): jet.Tuple0 +// </namespace name="kotlin1"> diff --git a/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListClone.txt b/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListClone.txt new file mode 100644 index 0000000000000..1bc597a31a8d3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListClone.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kotlin1"> +namespace kotlin1 + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="kotlin1"> diff --git a/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListToArray.txt b/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListToArray.txt new file mode 100644 index 0000000000000..1bc597a31a8d3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/jdk-annotations/ArrayListToArray.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kotlin1"> +namespace kotlin1 + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="kotlin1"> diff --git a/compiler/testData/lazyResolve/diagnostics/library/kt828.txt b/compiler/testData/lazyResolve/diagnostics/library/kt828.txt new file mode 100644 index 0000000000000..8a9f72ae98682 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/library/kt828.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/AssertNotNull.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/AssertNotNull.txt new file mode 100644 index 0000000000000..dc622bf14c5ed --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/AssertNotNull.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/InfixCallNullability.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/InfixCallNullability.txt new file mode 100644 index 0000000000000..8e877cf97c3bc --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/InfixCallNullability.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final fun contains(/*0*/ a: jet.Any?): jet.Boolean + internal final fun minus(): jet.Tuple0 + internal final fun plus(/*0*/ i: jet.Int): jet.Tuple0 +} +internal final fun A.div(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun test(/*0*/ x: jet.Int?, /*1*/ a: A?): jet.Tuple0 +internal final fun A?.times(/*0*/ i: jet.Int): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/NullableNothingIsExactlyNull.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/NullableNothingIsExactlyNull.txt new file mode 100644 index 0000000000000..8a9f72ae98682 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/NullableNothingIsExactlyNull.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/PreferExtensionsOnNullableReceiver.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/PreferExtensionsOnNullableReceiver.txt new file mode 100644 index 0000000000000..fbae1cecec9be --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/PreferExtensionsOnNullableReceiver.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final class Foo : jet.Any { + public final /*constructor*/ fun <init>(): Foo + internal final fun foo(): jet.Tuple0 +} +internal final fun jet.Any?.foo(): jet.Tuple0 +internal final fun test(/*0*/ f: Foo?): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/QualifiedExpressionNullability.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/QualifiedExpressionNullability.txt new file mode 100644 index 0000000000000..6eb0e520c461f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/QualifiedExpressionNullability.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class Foo : jet.Any { + public final /*constructor*/ fun <init>(): Foo + internal final fun foo(/*0*/ a: Foo): Foo +} +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/ReceiverNullability.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/ReceiverNullability.txt new file mode 100644 index 0000000000000..1e7b0cb167619 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/ReceiverNullability.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final fun foo(): jet.Tuple0 +} +internal final fun A.bar(): jet.Tuple0 +internal final fun A?.buzz(): jet.Tuple0 +internal final fun test(/*0*/ a: A?): jet.Tuple0 +internal final fun A.test2(): jet.Tuple0 +internal final fun A?.test3(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/funcLiteralArgsInsideUnresolvedFunction.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/funcLiteralArgsInsideUnresolvedFunction.txt new file mode 100644 index 0000000000000..f09c4dce1a220 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/funcLiteralArgsInsideUnresolvedFunction.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final fun foo(): jet.Tuple0 +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1270.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1270.txt new file mode 100644 index 0000000000000..0987b0c6178c7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1270.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="kt1270"> +namespace kt1270 + +private final class kt1270.SomeClass : jet.Any { + public final /*constructor*/ fun <init>(): kt1270.SomeClass + internal final val value: jet.Int +} +internal final fun foo(): jet.Tuple0 +// </namespace name="kt1270"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1680.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1680.txt new file mode 100644 index 0000000000000..c02b697d9c723 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1680.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kt1680"> +namespace kt1680 + +internal final fun foo(): jet.Tuple0 +// </namespace name="kt1680"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1778.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1778.txt new file mode 100644 index 0000000000000..0051c85e82945 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt1778.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kt1778"> +namespace kt1778 + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="kt1778"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2109.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2109.txt new file mode 100644 index 0000000000000..fbd0b5234342f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2109.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt2109"> +namespace kt2109 + +internal final class kt2109.A : jet.Any { + public final /*constructor*/ fun <init>(): kt2109.A + internal final fun foo(): jet.Tuple0 +} +internal final fun kt2109.A?.bar(): jet.Tuple0 +internal final fun kt2109.A.baz(): jet.Tuple0 +// </namespace name="kt2109"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2125.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2125.txt new file mode 100644 index 0000000000000..517ad563608db --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2125.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="e"> +namespace e + +internal final fun main(): jet.Tuple0 +// </namespace name="e"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2146.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2146.txt new file mode 100644 index 0000000000000..c23acec5508a7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2146.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="kt2146"> +namespace kt2146 + +internal final fun f1(/*0*/ s: jet.Int?): jet.Int +internal final fun f2(/*0*/ s: jet.Int?): jet.Int +internal final fun f3(/*0*/ s: jet.Int?): jet.Int +internal final fun f4(/*0*/ s: jet.Int?): jet.Int +internal final fun f5(/*0*/ s: jet.Int?): jet.Int +internal final fun f6(/*0*/ s: jet.Int?): jet.Int +internal final fun f7(/*0*/ s: jet.Int?): jet.Int +// </namespace name="kt2146"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2164.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2164.txt new file mode 100644 index 0000000000000..781130097a8de --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2164.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt2164"> +namespace kt2164 + +internal final fun foo(/*0*/ x: jet.Int): jet.Int +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="kt2164"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2176.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2176.txt new file mode 100644 index 0000000000000..7ec2e1d1bd499 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2176.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="kt2176"> +namespace kt2176 + +internal final fun f1(/*0*/ a: jet.String?): jet.Tuple0 +internal final fun f2(/*0*/ a: jet.String): jet.Tuple0 +internal final fun f3(/*0*/ a: jet.Any?): jet.Tuple0 +internal final fun f4(/*0*/ a: jet.Any): jet.Tuple0 +internal final fun f5(/*0*/ a: jet.String): jet.Tuple0 +// </namespace name="kt2176"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2195.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2195.txt new file mode 100644 index 0000000000000..ff237fac1cf17 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2195.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="foo"> +namespace foo + +private final fun </*0*/ T : jet.Any?>sendCommand(/*0*/ errorCallback: jet.Function0<jet.Tuple0>? = ?): jet.Tuple0 +// </namespace name="foo"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2212.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2212.txt new file mode 100644 index 0000000000000..5f80ce6a9e57f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2212.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kt2212"> +namespace kt2212 + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="kt2212"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2216.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2216.txt new file mode 100644 index 0000000000000..cd5bbc37a1c2f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2216.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="kt2216"> +namespace kt2216 + +internal final fun bar(/*0*/ y: jet.Int, /*1*/ z: jet.Int): jet.Int +internal final fun baz(/*0*/ a: jet.Int, /*1*/ b: jet.Int, /*2*/ c: jet.Int, /*3*/ d: jet.Int): jet.Int +internal final fun foo(): jet.Tuple0 +// </namespace name="kt2216"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2223.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2223.txt new file mode 100644 index 0000000000000..4064d3443d8d5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2223.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="kt2223"> +namespace kt2223 + +internal final fun foo(): jet.Tuple0 +// </namespace name="kt2223"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2234.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2234.txt new file mode 100644 index 0000000000000..bd37813b0997b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt2234.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final fun foo(): jet.Tuple0 +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt244.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt244.txt new file mode 100644 index 0000000000000..5934e1aa9b488 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt244.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt244"> +namespace kt244 + +internal final class kt244.A : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ a: jet.String?): kt244.A + internal final val b: jet.Int + internal final val i: jet.Int +} +internal final fun f(/*0*/ s: jet.String?): jet.Tuple0 +// </namespace name="kt244"> diff --git a/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt362.txt b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt362.txt new file mode 100644 index 0000000000000..f852a63f2f04e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/nullabilityAndAutoCasts/kt362.txt @@ -0,0 +1,23 @@ +namespace <root> + +// <namespace name="example"> +namespace example + +internal final fun test(): jet.Tuple0 +// </namespace name="example"> +// <namespace name="test"> +namespace test + +internal final class test.Internal : jet.Any { + public final val public: jet.Int? + protected final val protected: jet.Int? + internal final val internal: jet.Int? + public final /*constructor*/ fun <init>(): test.Internal +} +public final class test.Public : jet.Any { + public final val public: jet.Int? + protected final val protected: jet.Int? + internal final val internal: jet.Int? + public final /*constructor*/ fun <init>(): test.Public +} +// </namespace name="test"> diff --git a/compiler/testData/lazyResolve/diagnostics/objects/Objects.txt b/compiler/testData/lazyResolve/diagnostics/objects/Objects.txt new file mode 100644 index 0000000000000..4439d3ed6cdf0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/objects/Objects.txt @@ -0,0 +1,19 @@ +namespace <root> + +// <namespace name="toplevelObjectDeclarations"> +namespace toplevelObjectDeclarations + +internal open class toplevelObjectDeclarations.Foo : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ y: jet.Int): toplevelObjectDeclarations.Foo + internal open fun foo(): jet.Int +} +internal final class toplevelObjectDeclarations.T : toplevelObjectDeclarations.Foo { + public final /*constructor*/ fun <init>(): toplevelObjectDeclarations.T + internal open override /*1*/ fun foo(): jet.Int +} +internal final val A: toplevelObjectDeclarations.A +internal final val B: toplevelObjectDeclarations.B +internal final val x: jet.Int +internal final val y: toplevelObjectDeclarations.<no name provided> +internal final val z: jet.Int +// </namespace name="toplevelObjectDeclarations"> diff --git a/compiler/testData/lazyResolve/diagnostics/objects/ObjectsInheritance.txt b/compiler/testData/lazyResolve/diagnostics/objects/ObjectsInheritance.txt new file mode 100644 index 0000000000000..55f2510996fcf --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/objects/ObjectsInheritance.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="toplevelObjectDeclarations"> +namespace toplevelObjectDeclarations + +internal final val CObj: toplevelObjectDeclarations.CObj +internal final val DOjb: toplevelObjectDeclarations.DOjb +// </namespace name="toplevelObjectDeclarations"> diff --git a/compiler/testData/lazyResolve/diagnostics/objects/ObjectsLocal.txt b/compiler/testData/lazyResolve/diagnostics/objects/ObjectsLocal.txt new file mode 100644 index 0000000000000..a3d8c4efaf419 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/objects/ObjectsLocal.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="localObjects"> +namespace localObjects + +internal open class localObjects.Foo : jet.Any { + public final /*constructor*/ fun <init>(): localObjects.Foo + internal final fun foo(): jet.Int +} +internal final val A: localObjects.A +internal final val bb: [ERROR : <ERROR FUNCTION RETURN TYPE>] +internal final fun test(): jet.Tuple0 +// </namespace name="localObjects"> diff --git a/compiler/testData/lazyResolve/diagnostics/objects/ObjectsNested.txt b/compiler/testData/lazyResolve/diagnostics/objects/ObjectsNested.txt new file mode 100644 index 0000000000000..8bbf7d09cd85c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/objects/ObjectsNested.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="nestedObejcts"> +namespace nestedObejcts + +internal final val A: nestedObejcts.A +internal final val B: nestedObejcts.B +internal final val a: nestedObejcts.A +internal final val b: nestedObejcts.B +internal final val c: nestedObejcts.A.B +internal final val d: nestedObejcts.A.B.A +internal final val e: [ERROR : <ERROR PROPERTY TYPE>] +// </namespace name="nestedObejcts"> diff --git a/compiler/testData/lazyResolve/diagnostics/objects/kt2240.txt b/compiler/testData/lazyResolve/diagnostics/objects/kt2240.txt new file mode 100644 index 0000000000000..880ac59f2ce1a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/objects/kt2240.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final class a.A : jet.Any { + public final /*constructor*/ fun <init>(): a.A +} +internal final val o: a.<no name provided> +internal final fun </*0*/ T : jet.Any?>a.A.foo(/*0*/ f: T): jet.Tuple0 +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/AssignOperatorAmbiguity.txt b/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/AssignOperatorAmbiguity.txt new file mode 100644 index 0000000000000..7ad0e047ef8cf --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/AssignOperatorAmbiguity.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="kt1820"> +namespace kt1820 + +internal final class kt1820.MyInt : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ i: jet.Int): kt1820.MyInt + internal final val i: jet.Int + internal final fun plus(/*0*/ m: kt1820.MyInt): kt1820.MyInt +} +internal final fun jet.Any.plusAssign(/*0*/ a: jet.Any): jet.Tuple0 +internal final fun test(/*0*/ m: kt1820.MyInt): jet.Tuple0 +// </namespace name="kt1820"> diff --git a/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/IteratorAmbiguity.txt b/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/IteratorAmbiguity.txt new file mode 100644 index 0000000000000..c6615a95f13fe --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/IteratorAmbiguity.txt @@ -0,0 +1,20 @@ +namespace <root> + +internal abstract trait MyAnotherCollectionInterface : jet.Any { +} +internal final class MyCollection : MyCollectionInterface, MyAnotherCollectionInterface { + public final /*constructor*/ fun <init>(): MyCollection +} +internal abstract trait MyCollectionInterface : jet.Any { +} +internal final class MyElement : jet.Any { + public final /*constructor*/ fun <init>(): MyElement +} +internal final class MyIterator : jet.Any { + public final /*constructor*/ fun <init>(): MyIterator + internal final fun hasNext(): jet.Boolean + internal final fun next(): MyElement +} +internal final fun MyAnotherCollectionInterface.iterator(): MyIterator +internal final fun MyCollectionInterface.iterator(): MyIterator +internal final fun test1(/*0*/ collection: MyCollection): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/kt1028.txt b/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/kt1028.txt new file mode 100644 index 0000000000000..c0d78048d7742 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/operatorsOverloading/kt1028.txt @@ -0,0 +1,26 @@ +namespace <root> + +// <namespace name="kt1028"> +namespace kt1028 + +internal final class kt1028.Control : jet.Any { + public final /*constructor*/ fun <init>(): kt1028.Control + public final val MouseMoved: kt1028.event<kt1028.MouseMovedEventArgs> + internal final fun MoveMouse(): jet.Tuple0 +} +internal final class kt1028.MouseMovedEventArgs : jet.Any { + public final /*constructor*/ fun <init>(): kt1028.MouseMovedEventArgs + public final val X: jet.Int +} +internal final class kt1028.Test : jet.Any { + public final /*constructor*/ fun <init>(): kt1028.Test + internal final fun test(): jet.Tuple0 +} +internal final class kt1028.event</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): kt1028.event<T> + internal final fun call(/*0*/ value: T): jet.Tuple0 + internal final val callbacks: java.util.ArrayList<jet.Function1<T, jet.Tuple0>> + internal final fun minusAssign(/*0*/ f: jet.Function1<T, jet.Tuple0>): jet.Boolean + internal final fun plusAssign(/*0*/ f: jet.Function1<T, jet.Tuple0>): jet.Boolean +} +// </namespace name="kt1028"> diff --git a/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsFunsDifferentReturnInClass.txt b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsFunsDifferentReturnInClass.txt new file mode 100644 index 0000000000000..7023b439ed12e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsFunsDifferentReturnInClass.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final fun a(/*0*/ a: jet.Int): jet.Int + internal final fun a(/*0*/ a: jet.Int): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsFunsDifferentReturnInPackage.txt b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsFunsDifferentReturnInPackage.txt new file mode 100644 index 0000000000000..b0f26b10ac738 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsFunsDifferentReturnInPackage.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="qwertyuiop"> +namespace qwertyuiop + +internal final fun c(/*0*/ s: jet.String): jet.Tuple0 +internal final fun c(/*0*/ s: jet.String): jet.Tuple0 +// </namespace name="qwertyuiop"> diff --git a/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalExtFunsInPackage.txt b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalExtFunsInPackage.txt new file mode 100644 index 0000000000000..2bee10793dd14 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalExtFunsInPackage.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="extensionFunctions"> +namespace extensionFunctions + +internal final fun jet.Int.qwe(/*0*/ a: jet.Float): jet.Int +internal final fun jet.Int.qwe(/*0*/ a: jet.Float): jet.Int +// </namespace name="extensionFunctions"> diff --git a/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalFunsInClass.txt b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalFunsInClass.txt new file mode 100644 index 0000000000000..fe0cebc975091 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalFunsInClass.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final fun b(): jet.Tuple0 + internal final fun b(): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalValsInClass.txt b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalValsInClass.txt new file mode 100644 index 0000000000000..35e6be0f99a50 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsIdenticalValsInClass.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class Aaa : jet.Any { + public final /*constructor*/ fun <init>(): Aaa + internal final val a: jet.Int + internal final val a: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsValsDifferentTypeInClass.txt b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsValsDifferentTypeInClass.txt new file mode 100644 index 0000000000000..e516646a23fe2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/ConflictingOverloadsValsDifferentTypeInClass.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class Aaa : jet.Any { + public final /*constructor*/ fun <init>(): Aaa + internal final val a: jet.Int + internal final val a: jet.String +} diff --git a/compiler/testData/lazyResolve/diagnostics/overload/ConstructorVsFunOverload.txt b/compiler/testData/lazyResolve/diagnostics/overload/ConstructorVsFunOverload.txt new file mode 100644 index 0000000000000..c93803b7356e5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/ConstructorVsFunOverload.txt @@ -0,0 +1,37 @@ +namespace <root> + +// <namespace name="constructorVsFun"> +namespace constructorVsFun + +internal final class constructorVsFun.Rtyu : jet.Any { + public final /*constructor*/ fun <init>(): constructorVsFun.Rtyu + internal final fun ololo(): jet.Tuple0 + internal final object constructorVsFun.Rtyu.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): constructorVsFun.Rtyu.<no name provided> + internal final class constructorVsFun.Rtyu.<no name provided>.ololo : jet.Any { + public final /*constructor*/ fun <init>(): constructorVsFun.Rtyu.<no name provided>.ololo + } + } +} +internal final class constructorVsFun.Tram : jet.Any { + public final /*constructor*/ fun <init>(): constructorVsFun.Tram + internal final class constructorVsFun.Tram.f : jet.Any { + public final /*constructor*/ fun <init>(): constructorVsFun.Tram.f + } + internal final fun f(): jet.Tuple0 +} +internal final class constructorVsFun.Yvayva : jet.Any { + public final /*constructor*/ fun <init>(): constructorVsFun.Yvayva + internal final object constructorVsFun.Yvayva.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): constructorVsFun.Yvayva.<no name provided> + internal final class constructorVsFun.Yvayva.<no name provided>.fghj : jet.Any { + public final /*constructor*/ fun <init>(): constructorVsFun.Yvayva.<no name provided>.fghj + } + internal final fun fghj(): jet.Tuple0 + } +} +internal final class constructorVsFun.a : jet.Any { + public final /*constructor*/ fun <init>(): constructorVsFun.a +} +internal final fun a(): jet.Int +// </namespace name="constructorVsFun"> diff --git a/compiler/testData/lazyResolve/diagnostics/overload/ExtFunDifferentReceiver.txt b/compiler/testData/lazyResolve/diagnostics/overload/ExtFunDifferentReceiver.txt new file mode 100644 index 0000000000000..118f0018e4a3c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/ExtFunDifferentReceiver.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun jet.Int.rty(): jet.Int +internal final fun jet.String.rty(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/overload/FunNoConflictInDifferentPackages.txt b/compiler/testData/lazyResolve/diagnostics/overload/FunNoConflictInDifferentPackages.txt new file mode 100644 index 0000000000000..98c8f1da7cb1c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/FunNoConflictInDifferentPackages.txt @@ -0,0 +1,21 @@ +namespace <root> + +// <namespace name="ns1"> +namespace ns1 + +internal final fun e(): jet.Int +// </namespace name="ns1"> +// <namespace name="ns2"> +namespace ns2 + +internal final fun e(): jet.Int +// </namespace name="ns2"> +// <namespace name="ns3"> +namespace ns3 + +// <namespace name="ns1"> +namespace ns1 + +internal final fun e(): jet.Int +// </namespace name="ns1"> +// </namespace name="ns3"> diff --git a/compiler/testData/lazyResolve/diagnostics/overload/OverloadFunRegularAndExt.txt b/compiler/testData/lazyResolve/diagnostics/overload/OverloadFunRegularAndExt.txt new file mode 100644 index 0000000000000..3749e9defb86f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/OverloadFunRegularAndExt.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="extensionAndRegular"> +namespace extensionAndRegular + +internal final fun jet.Int.who(): jet.Int +internal final fun who(): jet.Int +// </namespace name="extensionAndRegular"> diff --git a/compiler/testData/lazyResolve/diagnostics/overload/OverloadVarAndFunInClass.txt b/compiler/testData/lazyResolve/diagnostics/overload/OverloadVarAndFunInClass.txt new file mode 100644 index 0000000000000..fe115c4686577 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/overload/OverloadVarAndFunInClass.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class Aaaa : jet.Any { + public final /*constructor*/ fun <init>(): Aaaa + internal final fun bb(): jet.Int + internal final val bb: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/AbstractFunImplemented.txt b/compiler/testData/lazyResolve/diagnostics/override/AbstractFunImplemented.txt new file mode 100644 index 0000000000000..67bfc5cdc2c74 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/AbstractFunImplemented.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal abstract class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal abstract fun foo(): jet.Int +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal open override /*1*/ fun foo(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/AbstractFunNotImplemented.txt b/compiler/testData/lazyResolve/diagnostics/override/AbstractFunNotImplemented.txt new file mode 100644 index 0000000000000..f0a8e4aed57c2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/AbstractFunNotImplemented.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal abstract class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal abstract fun foo(): jet.Int +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal abstract override /*1*/ fun foo(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/AbstractValImplemented.txt b/compiler/testData/lazyResolve/diagnostics/override/AbstractValImplemented.txt new file mode 100644 index 0000000000000..1b5c2d0c8f0df --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/AbstractValImplemented.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal abstract class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal abstract val i: jet.Int +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal open override /*1*/ val i: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/AbstractValNotImplemented.txt b/compiler/testData/lazyResolve/diagnostics/override/AbstractValNotImplemented.txt new file mode 100644 index 0000000000000..19f4c8a8db3d1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/AbstractValNotImplemented.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal abstract class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal abstract val i: jet.Int +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal abstract override /*1*/ val i: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/AbstractVarImplemented.txt b/compiler/testData/lazyResolve/diagnostics/override/AbstractVarImplemented.txt new file mode 100644 index 0000000000000..a880e410bb584 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/AbstractVarImplemented.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal abstract class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal abstract var i: jet.Int +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal open override /*1*/ var i: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/AbstractVarNotImplemented.txt b/compiler/testData/lazyResolve/diagnostics/override/AbstractVarNotImplemented.txt new file mode 100644 index 0000000000000..aabba56d2f9cc --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/AbstractVarNotImplemented.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal abstract class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal abstract var i: jet.Int +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal abstract override /*1*/ var i: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/ComplexValRedeclaration.txt b/compiler/testData/lazyResolve/diagnostics/override/ComplexValRedeclaration.txt new file mode 100644 index 0000000000000..0472c8a3f8cb0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/ComplexValRedeclaration.txt @@ -0,0 +1,19 @@ +namespace <root> + +// <namespace name="override"> +namespace override + +// <namespace name="generics"> +namespace generics + +internal abstract class override.generics.MyAbstractClass</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): override.generics.MyAbstractClass<T> + internal abstract val pr: T +} +internal abstract class override.generics.MyLegalAbstractClass2</*0*/ T : jet.Any?> : override.generics.MyAbstractClass<jet.Int> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ t: T): override.generics.MyLegalAbstractClass2<T> + internal final val </*0*/ R : jet.Any?> pr: T + internal abstract override /*1*/ val pr: jet.Int +} +// </namespace name="generics"> +// </namespace name="override"> diff --git a/compiler/testData/lazyResolve/diagnostics/override/ConflictingFunctionSignatureFromSuperclass.txt b/compiler/testData/lazyResolve/diagnostics/override/ConflictingFunctionSignatureFromSuperclass.txt new file mode 100644 index 0000000000000..08ea7cab9d645 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/ConflictingFunctionSignatureFromSuperclass.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal open class Aaa : jet.Any { + public final /*constructor*/ fun <init>(): Aaa + internal final fun foo(): jet.Int +} +internal open class Bbb : Aaa { + public final /*constructor*/ fun <init>(): Bbb + internal final fun </*0*/ T : jet.Any?>foo(): jet.Int + internal final override /*1*/ fun foo(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/ConflictingParameterNames-MultipleSupertypes.txt b/compiler/testData/lazyResolve/diagnostics/override/ConflictingParameterNames-MultipleSupertypes.txt new file mode 100644 index 0000000000000..1b56bc4f73b6a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/ConflictingParameterNames-MultipleSupertypes.txt @@ -0,0 +1,14 @@ +namespace <root> + +internal abstract trait C : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int): jet.Tuple0 +} +internal abstract trait D : jet.Any { + internal abstract fun foo(/*0*/ b: jet.Int): jet.Tuple0 +} +internal abstract trait E : C, D { + internal abstract override /*2*/ fun foo(/*0*/ a: jet.Int): jet.Tuple0 +} +internal abstract trait F : C, D { + internal open override /*2*/ fun foo(/*0*/ a: jet.Int): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/ConflictingParameterNames.txt b/compiler/testData/lazyResolve/diagnostics/override/ConflictingParameterNames.txt new file mode 100644 index 0000000000000..f9d5dc79fe945 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/ConflictingParameterNames.txt @@ -0,0 +1,16 @@ +namespace <root> + +internal abstract trait A : jet.Any { + internal abstract fun b(/*0*/ a: jet.Int): jet.Tuple0 +} +internal abstract trait B : A { + internal abstract override /*1*/ fun b(/*0*/ a: jet.Int): jet.Tuple0 +} +internal final class C1 : A { + public final /*constructor*/ fun <init>(): C1 + internal open override /*1*/ fun b(/*0*/ b: jet.Int): jet.Tuple0 +} +internal final class C2 : B { + public final /*constructor*/ fun <init>(): C2 + internal open override /*1*/ fun b(/*0*/ b: jet.Int): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/ConflictingPropertySignatureFromSuperclass.txt b/compiler/testData/lazyResolve/diagnostics/override/ConflictingPropertySignatureFromSuperclass.txt new file mode 100644 index 0000000000000..d7f55dd3917d5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/ConflictingPropertySignatureFromSuperclass.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal open class Aaa : jet.Any { + public final /*constructor*/ fun <init>(): Aaa + internal final val bar: jet.Int +} +internal open class Bbb : Aaa { + public final /*constructor*/ fun <init>(): Bbb + internal final override /*1*/ val bar: jet.Int + internal final val </*0*/ T : jet.Any?> bar: jet.String +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/DefaultParameterValueInOverride.txt b/compiler/testData/lazyResolve/diagnostics/override/DefaultParameterValueInOverride.txt new file mode 100644 index 0000000000000..a86972510e2f2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/DefaultParameterValueInOverride.txt @@ -0,0 +1,14 @@ +namespace <root> + +internal open class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal open fun foo(/*0*/ a: jet.Int): jet.Tuple0 +} +internal final class C : A { + public final /*constructor*/ fun <init>(): C + internal open override /*1*/ fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final class D : A { + public final /*constructor*/ fun <init>(): D + internal open override /*1*/ fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/DefaultParameterValues-NoErrorsWhenInheritingFromOneTypeTwice.txt b/compiler/testData/lazyResolve/diagnostics/override/DefaultParameterValues-NoErrorsWhenInheritingFromOneTypeTwice.txt new file mode 100644 index 0000000000000..3c03f6051983e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/DefaultParameterValues-NoErrorsWhenInheritingFromOneTypeTwice.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal abstract trait Y : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal abstract trait YSub : Y { + internal abstract override /*1*/ fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final class Z2 : Y, YSub { + public final /*constructor*/ fun <init>(): Z2 + internal open override /*2*/ fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final val Z2O: Z2O diff --git a/compiler/testData/lazyResolve/diagnostics/override/EqualityOfIntersectionTypes.txt b/compiler/testData/lazyResolve/diagnostics/override/EqualityOfIntersectionTypes.txt new file mode 100644 index 0000000000000..7cf9693ba6415 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/EqualityOfIntersectionTypes.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal abstract trait A : jet.Any { + internal open fun </*0*/ T : Bar & Foo>foo(): jet.Tuple0 +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal open override /*1*/ fun </*0*/ T : Bar & Foo>foo(): jet.Tuple0 +} +internal abstract trait Bar : jet.Any { +} +internal abstract trait Foo : jet.Any { +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/ExtendFunctionClass.txt b/compiler/testData/lazyResolve/diagnostics/override/ExtendFunctionClass.txt new file mode 100644 index 0000000000000..eac9e004e33f6 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/ExtendFunctionClass.txt @@ -0,0 +1,14 @@ +namespace <root> + +// <namespace name="extendFunctionClass"> +namespace extendFunctionClass + +internal final class extendFunctionClass.A : jet.Function1<jet.Int, jet.Int> { + public final /*constructor*/ fun <init>(): extendFunctionClass.A + public abstract override /*1*/ fun invoke(/*0*/ p1: jet.Int): jet.Int +} +internal final class extendFunctionClass.B : jet.Function1<jet.Int, jet.Int> { + public final /*constructor*/ fun <init>(): extendFunctionClass.B + public open override /*1*/ fun invoke(/*0*/ p1: jet.Int): jet.Int +} +// </namespace name="extendFunctionClass"> diff --git a/compiler/testData/lazyResolve/diagnostics/override/FakeOverrideAbstractAndNonAbstractFun.txt b/compiler/testData/lazyResolve/diagnostics/override/FakeOverrideAbstractAndNonAbstractFun.txt new file mode 100644 index 0000000000000..6c2c32fc25212 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/FakeOverrideAbstractAndNonAbstractFun.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal open class Ccc : jet.Any { + public final /*constructor*/ fun <init>(): Ccc + internal final fun foo(): jet.Int +} +internal abstract trait Ttt : jet.Any { + internal abstract fun foo(): jet.Int +} +internal final class Zzz : Ccc, Ttt { + public final /*constructor*/ fun <init>(): Zzz + internal final override /*2*/ fun foo(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/Generics.txt b/compiler/testData/lazyResolve/diagnostics/override/Generics.txt new file mode 100644 index 0000000000000..244bcf1a9eca3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/Generics.txt @@ -0,0 +1,105 @@ +namespace <root> + +// <namespace name="override"> +namespace override + +// <namespace name="generics"> +namespace generics + +internal abstract class override.generics.MyAbstractClass</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): override.generics.MyAbstractClass<T> + internal abstract fun bar(/*0*/ t: T): T + internal abstract val pr: T +} +internal abstract class override.generics.MyAbstractClass1 : override.generics.MyTrait<jet.Int>, override.generics.MyAbstractClass<jet.String> { + public final /*constructor*/ fun <init>(): override.generics.MyAbstractClass1 + internal open override /*1*/ fun bar(/*0*/ t: jet.String): jet.String + internal open override /*1*/ fun foo(/*0*/ t: jet.Int): jet.Int + internal abstract override /*1*/ val pr: jet.String +} +internal final class override.generics.MyChildClass : override.generics.MyGenericClass<jet.Int> { + public final /*constructor*/ fun <init>(): override.generics.MyChildClass + internal open override /*1*/ fun bar(/*0*/ t: jet.Int): jet.Int + internal open override /*1*/ fun foo(/*0*/ t: jet.Int): jet.Int + internal open override /*1*/ val p: jet.Int + internal open override /*1*/ val pr: jet.Int +} +internal final class override.generics.MyChildClass1</*0*/ T : jet.Any?> : override.generics.MyGenericClass<T> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ t: T): override.generics.MyChildClass1<T> + internal open override /*1*/ fun bar(/*0*/ t: T): T + internal open override /*1*/ fun foo(/*0*/ t: T): T + internal open override /*1*/ val p: T + internal open override /*1*/ val pr: T +} +internal final class override.generics.MyChildClass2</*0*/ T : jet.Any?> : override.generics.MyGenericClass<T> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ t: T): override.generics.MyChildClass2<T> + internal open override /*1*/ fun bar(/*0*/ t: T): T + internal final override /*1*/ fun foo(/*0*/ t: T): T + internal open override /*1*/ val p: T + internal final override /*1*/ val pr: T +} +internal open class override.generics.MyClass : override.generics.MyTrait<jet.Int>, override.generics.MyAbstractClass<jet.String> { + public final /*constructor*/ fun <init>(): override.generics.MyClass + internal open override /*1*/ fun bar(/*0*/ t: jet.String): jet.String + internal open override /*1*/ fun foo(/*0*/ t: jet.Int): jet.Int + internal open override /*1*/ val pr: jet.String +} +internal open class override.generics.MyGenericClass</*0*/ T : jet.Any?> : override.generics.MyTrait<T>, override.generics.MyAbstractClass<T>, override.generics.MyProps<T> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ t: T): override.generics.MyGenericClass<T> + internal open override /*1*/ fun bar(/*0*/ t: T): T + internal open override /*1*/ fun foo(/*0*/ t: T): T + internal open override /*1*/ val p: T + internal open override /*1*/ val pr: T +} +internal final class override.generics.MyIllegalClass1 : override.generics.MyTrait<jet.Int>, override.generics.MyAbstractClass<jet.String> { + public final /*constructor*/ fun <init>(): override.generics.MyIllegalClass1 + internal abstract override /*1*/ fun bar(/*0*/ t: jet.String): jet.String + internal abstract override /*1*/ fun foo(/*0*/ t: jet.Int): jet.Int + internal abstract override /*1*/ val pr: jet.String +} +internal final class override.generics.MyIllegalClass2</*0*/ T : jet.Any?> : override.generics.MyTrait<jet.Int>, override.generics.MyAbstractClass<jet.Int> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ t: T): override.generics.MyIllegalClass2<T> + internal final fun bar(/*0*/ t: T): T + internal abstract override /*1*/ fun bar(/*0*/ t: jet.Int): jet.Int + internal final fun foo(/*0*/ t: T): T + internal abstract override /*1*/ fun foo(/*0*/ t: jet.Int): jet.Int + internal final val </*0*/ R : jet.Any?> pr: T + internal abstract override /*1*/ val pr: jet.Int +} +internal final class override.generics.MyIllegalGenericClass1</*0*/ T : jet.Any?> : override.generics.MyTrait<T>, override.generics.MyAbstractClass<T> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): override.generics.MyIllegalGenericClass1<T> + internal abstract override /*1*/ fun bar(/*0*/ t: T): T + internal abstract override /*1*/ fun foo(/*0*/ t: T): T + internal abstract override /*1*/ val pr: T +} +internal final class override.generics.MyIllegalGenericClass2</*0*/ T : jet.Any?, /*1*/ R : jet.Any?> : override.generics.MyTrait<T>, override.generics.MyAbstractClass<R> { + public final /*constructor*/ fun </*0*/ T : jet.Any?, /*1*/ R : jet.Any?><init>(/*0*/ r: R): override.generics.MyIllegalGenericClass2<T, R> + internal abstract override /*1*/ fun bar(/*0*/ t: R): R + internal open fun foo(/*0*/ r: R): R + internal abstract override /*1*/ fun foo(/*0*/ t: T): T + internal abstract override /*1*/ val pr: R + internal open val </*0*/ T : jet.Any?> pr: R +} +internal abstract class override.generics.MyLegalAbstractClass1 : override.generics.MyTrait<jet.Int>, override.generics.MyAbstractClass<jet.String> { + public final /*constructor*/ fun <init>(): override.generics.MyLegalAbstractClass1 + internal abstract override /*1*/ fun bar(/*0*/ t: jet.String): jet.String + internal abstract override /*1*/ fun foo(/*0*/ t: jet.Int): jet.Int + internal abstract override /*1*/ val pr: jet.String +} +internal abstract class override.generics.MyLegalAbstractClass2</*0*/ T : jet.Any?> : override.generics.MyTrait<jet.Int>, override.generics.MyAbstractClass<jet.Int> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ t: T): override.generics.MyLegalAbstractClass2<T> + internal final fun bar(/*0*/ t: T): T + internal abstract override /*1*/ fun bar(/*0*/ t: jet.Int): jet.Int + internal final fun foo(/*0*/ t: T): T + internal abstract override /*1*/ fun foo(/*0*/ t: jet.Int): jet.Int + internal final val </*0*/ R : jet.Any?> pr: T + internal abstract override /*1*/ val pr: jet.Int +} +internal abstract trait override.generics.MyProps</*0*/ T : jet.Any?> : jet.Any { + internal abstract val p: T +} +internal abstract trait override.generics.MyTrait</*0*/ T : jet.Any?> : jet.Any { + internal abstract fun foo(/*0*/ t: T): T +} +// </namespace name="generics"> +// </namespace name="override"> diff --git a/compiler/testData/lazyResolve/diagnostics/override/InvisiblePotentialOverride.txt b/compiler/testData/lazyResolve/diagnostics/override/InvisiblePotentialOverride.txt new file mode 100644 index 0000000000000..5858324151f82 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/InvisiblePotentialOverride.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal open class A : jet.Any { + public final /*constructor*/ fun <init>(): A + private final fun foo(): jet.Int +} +internal final class B : A { + public final /*constructor*/ fun <init>(): B + internal final fun foo(): jet.String + invisible_fake final override /*1*/ fun foo(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultParametersInSupertypes.txt b/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultParametersInSupertypes.txt new file mode 100644 index 0000000000000..939fe6bbb7d91 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultParametersInSupertypes.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal abstract trait X : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal abstract trait Y : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final class Z : X, Y { + public final /*constructor*/ fun <init>(): Z + internal open override /*2*/ fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final val ZO: ZO diff --git a/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultParametersInSupertypesNoOverride.txt b/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultParametersInSupertypesNoOverride.txt new file mode 100644 index 0000000000000..95958c0285e0f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultParametersInSupertypesNoOverride.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal abstract trait X : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal abstract trait Y : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final class Z : X, Y { + public final /*constructor*/ fun <init>(): Z + internal final override /*2*/ fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final val ZO: ZO diff --git a/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultsInSupertypesNoExplicitOverride.txt b/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultsInSupertypesNoExplicitOverride.txt new file mode 100644 index 0000000000000..58077d1cddbdf --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/MultipleDefaultsInSupertypesNoExplicitOverride.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal abstract trait X : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal abstract trait Y : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final class Z1 : X, Y { + public final /*constructor*/ fun <init>(): Z1 + internal abstract override /*2*/ fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal final val Z1O: Z1O diff --git a/compiler/testData/lazyResolve/diagnostics/override/NonGenerics.txt b/compiler/testData/lazyResolve/diagnostics/override/NonGenerics.txt new file mode 100644 index 0000000000000..fa125f197f73a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/NonGenerics.txt @@ -0,0 +1,70 @@ +namespace <root> + +// <namespace name="override"> +namespace override + +// <namespace name="normal"> +namespace normal + +internal abstract class override.normal.MyAbstractClass : jet.Any { + public final /*constructor*/ fun <init>(): override.normal.MyAbstractClass + internal abstract fun bar(): jet.Tuple0 + internal abstract val prr: jet.Tuple0 +} +internal final class override.normal.MyChildClass : override.normal.MyClass { + public final /*constructor*/ fun <init>(): override.normal.MyChildClass + internal open override /*1*/ fun bar(): jet.Tuple0 + internal open override /*1*/ fun foo(): jet.Tuple0 + internal open override /*1*/ val pr: jet.Tuple0 + internal open override /*1*/ val prr: jet.Tuple0 +} +internal final class override.normal.MyChildClass1 : override.normal.MyClass { + public final /*constructor*/ fun <init>(): override.normal.MyChildClass1 + internal open override /*1*/ fun bar(): jet.Tuple0 + internal final override /*1*/ fun foo(): jet.Tuple0 + internal final override /*1*/ val pr: jet.Tuple0 + internal open override /*1*/ val prr: jet.Tuple0 +} +internal open class override.normal.MyClass : override.normal.MyTrait, override.normal.MyAbstractClass { + public final /*constructor*/ fun <init>(): override.normal.MyClass + internal open override /*1*/ fun bar(): jet.Tuple0 + internal open override /*1*/ fun foo(): jet.Tuple0 + internal open override /*1*/ val pr: jet.Tuple0 + internal open override /*1*/ val prr: jet.Tuple0 +} +internal final class override.normal.MyIllegalClass : override.normal.MyTrait, override.normal.MyAbstractClass { + public final /*constructor*/ fun <init>(): override.normal.MyIllegalClass + internal abstract override /*1*/ fun bar(): jet.Tuple0 + internal abstract override /*1*/ fun foo(): jet.Tuple0 + internal abstract override /*1*/ val pr: jet.Tuple0 + internal abstract override /*1*/ val prr: jet.Tuple0 +} +internal final class override.normal.MyIllegalClass2 : override.normal.MyTrait, override.normal.MyAbstractClass { + public final /*constructor*/ fun <init>(): override.normal.MyIllegalClass2 + internal abstract override /*1*/ fun bar(): jet.Tuple0 + internal open override /*1*/ fun foo(): jet.Tuple0 + internal open override /*1*/ val pr: jet.Tuple0 + internal open override /*1*/ val prr: jet.Tuple0 +} +internal final class override.normal.MyIllegalClass3 : override.normal.MyTrait, override.normal.MyAbstractClass { + public final /*constructor*/ fun <init>(): override.normal.MyIllegalClass3 + internal open override /*1*/ fun bar(): jet.Tuple0 + internal abstract override /*1*/ fun foo(): jet.Tuple0 + internal open override /*1*/ val pr: jet.Tuple0 + internal open override /*1*/ val prr: jet.Tuple0 +} +internal final class override.normal.MyIllegalClass4 : override.normal.MyTrait, override.normal.MyAbstractClass { + public final /*constructor*/ fun <init>(): override.normal.MyIllegalClass4 + internal abstract override /*1*/ fun bar(): jet.Tuple0 + internal final override /*1*/ fun foo(): jet.Tuple0 + internal open fun other(): jet.Tuple0 + internal open val otherPr: jet.Int + internal final override /*1*/ val pr: jet.Tuple0 + internal abstract override /*1*/ val prr: jet.Tuple0 +} +internal abstract trait override.normal.MyTrait : jet.Any { + internal abstract fun foo(): jet.Tuple0 + internal abstract val pr: jet.Tuple0 +} +// </namespace name="normal"> +// </namespace name="override"> diff --git a/compiler/testData/lazyResolve/diagnostics/override/ParameterDefaultValues-DefaultValueFromOnlyOneSupertype.txt b/compiler/testData/lazyResolve/diagnostics/override/ParameterDefaultValues-DefaultValueFromOnlyOneSupertype.txt new file mode 100644 index 0000000000000..9c6fb4c0e60d8 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/ParameterDefaultValues-DefaultValueFromOnlyOneSupertype.txt @@ -0,0 +1,12 @@ +namespace <root> + +internal abstract trait X : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} +internal abstract trait Y : jet.Any { + internal abstract fun foo(/*0*/ a: jet.Int): jet.Tuple0 +} +internal final class Z : X, Y { + public final /*constructor*/ fun <init>(): Z + internal open override /*2*/ fun foo(/*0*/ a: jet.Int = ?): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/SuspiciousCase1.txt b/compiler/testData/lazyResolve/diagnostics/override/SuspiciousCase1.txt new file mode 100644 index 0000000000000..e70daad2e0fce --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/SuspiciousCase1.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal abstract trait Bar</*0*/ Q : jet.Any?> : Foo<Q> { + internal open override /*1*/ fun quux(/*0*/ p: Q, /*1*/ q: jet.Int = ?): jet.Int +} +internal abstract class Baz : Bar<jet.String> { + public final /*constructor*/ fun <init>(): Baz + internal open override /*1*/ fun quux(/*0*/ p: jet.String, /*1*/ q: jet.Int = ?): jet.Int +} +internal abstract trait Foo</*0*/ P : jet.Any?> : jet.Any { + internal open fun quux(/*0*/ p: P, /*1*/ q: jet.Int = ?): jet.Int +} +internal final fun zz(/*0*/ b: Baz): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/override/ToAbstractMembersFromSuper-kt1996.txt b/compiler/testData/lazyResolve/diagnostics/override/ToAbstractMembersFromSuper-kt1996.txt new file mode 100644 index 0000000000000..c02180a656c3c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/ToAbstractMembersFromSuper-kt1996.txt @@ -0,0 +1,12 @@ +namespace <root> + +internal abstract trait Bar : jet.Any { + internal abstract fun foo(): jet.Tuple0 +} +internal final class Baz : Foo, Bar { + public final /*constructor*/ fun <init>(): Baz + internal abstract override /*2*/ fun foo(): jet.Tuple0 +} +internal abstract trait Foo : jet.Any { + internal abstract fun foo(): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/override/kt1862.txt b/compiler/testData/lazyResolve/diagnostics/override/kt1862.txt new file mode 100644 index 0000000000000..96cc596b29d0b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/override/kt1862.txt @@ -0,0 +1,17 @@ +namespace <root> + +internal open class Aaa : jet.Any { + public final /*constructor*/ fun <init>(): Aaa + internal open fun foo(): jet.Int +} +internal open class Bbb : Aaa { + public final /*constructor*/ fun <init>(): Bbb + internal open override /*1*/ fun foo(): jet.Int +} +internal abstract trait Ccc : Aaa { + internal open override /*1*/ fun foo(): jet.Int +} +internal final class Ddd : Bbb, Ccc { + public final /*constructor*/ fun <init>(): Ddd + internal open override /*2*/ fun foo(): jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/AmbiguityOnLazyTypeComputation.txt b/compiler/testData/lazyResolve/diagnostics/regressions/AmbiguityOnLazyTypeComputation.txt new file mode 100644 index 0000000000000..5e9050c2b602d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/AmbiguityOnLazyTypeComputation.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="x"> +namespace x + +internal final class x.Foo : jet.Any { + public final /*constructor*/ fun <init>(): x.Foo + internal final fun compareTo(/*0*/ other: jet.Byte): jet.Int + internal final fun compareTo(/*0*/ other: jet.Char): jet.Int +} +internal final val a1: jet.Int +internal final val b: x.Foo +// </namespace name="x"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/AssignmentsUnderOperators.txt b/compiler/testData/lazyResolve/diagnostics/regressions/AssignmentsUnderOperators.txt new file mode 100644 index 0000000000000..8a9f72ae98682 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/AssignmentsUnderOperators.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/CoercionToUnit.txt b/compiler/testData/lazyResolve/diagnostics/regressions/CoercionToUnit.txt new file mode 100644 index 0000000000000..400f87e4f3efa --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/CoercionToUnit.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun foo(/*0*/ u: jet.Tuple0): jet.Int +internal final fun test(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/DoubleDefine.txt b/compiler/testData/lazyResolve/diagnostics/regressions/DoubleDefine.txt new file mode 100644 index 0000000000000..d4f60be446474 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/DoubleDefine.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final fun evaluate(/*0*/ expr: java.lang.StringBuilder, /*1*/ numbers: java.util.ArrayList<jet.Int>): jet.Int +internal final fun evaluateAdd(/*0*/ expr: java.lang.StringBuilder, /*1*/ numbers: java.util.ArrayList<jet.Int>): jet.Int +internal final fun evaluateArg(/*0*/ expr: jet.CharSequence, /*1*/ numbers: java.util.ArrayList<jet.Int>): jet.Int +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun takeFirst(/*0*/ expr: java.lang.StringBuilder): jet.Char diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/ErrorsOnIbjectExpressionsAsParameters.txt b/compiler/testData/lazyResolve/diagnostics/regressions/ErrorsOnIbjectExpressionsAsParameters.txt new file mode 100644 index 0000000000000..20d98c49f5b1b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/ErrorsOnIbjectExpressionsAsParameters.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun foo(/*0*/ a: jet.Any): jet.Tuple0 +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet11.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet11.txt new file mode 100644 index 0000000000000..70d2d58f77ad5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet11.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal open class NoC : jet.Any { + public final /*constructor*/ fun <init>(): NoC +} +internal final class NoC1 : NoC { + public final /*constructor*/ fun <init>(): NoC1 +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet121.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet121.txt new file mode 100644 index 0000000000000..40656e5f7f5ce --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet121.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="jet121"> +namespace jet121 + +internal final fun apply(/*0*/ arg: jet.String, /*1*/ f: jet.ExtensionFunction0<jet.String, jet.Int>): jet.Int +internal final fun box(): jet.String +// </namespace name="jet121"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet124.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet124.txt new file mode 100644 index 0000000000000..906406dc8cfb5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet124.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun foo(): jet.Tuple0 +internal final fun foo1(): jet.Function1<jet.Int, jet.Int> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet169.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet169.txt new file mode 100644 index 0000000000000..485284328720a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet169.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun set(/*0*/ key: jet.String, /*1*/ value: jet.String): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet17.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet17.txt new file mode 100644 index 0000000000000..4368a0787f0a0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet17.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class WithC : jet.Any { + public final /*constructor*/ fun <init>(): WithC + internal final val a: jet.Int + internal final val b: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet53.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet53.txt new file mode 100644 index 0000000000000..277fb8d2562fe --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet53.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final val ab: java.util.List<jet.Int>? diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet67.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet67.txt new file mode 100644 index 0000000000000..2afd760a213ce --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet67.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal abstract class XXX : jet.Any { + public final /*constructor*/ fun <init>(): XXX + internal abstract val a: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet68.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet68.txt new file mode 100644 index 0000000000000..e28689cf4ae0f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet68.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class Foo : jet.Any { + public final /*constructor*/ fun <init>(): Foo +} +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet69.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet69.txt new file mode 100644 index 0000000000000..54d2f7f98be72 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet69.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final class Command : jet.Any { + public final /*constructor*/ fun <init>(): Command +} +internal final fun jet.Any.equals(/*0*/ other: jet.Any?): jet.Boolean +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun parse(/*0*/ cmd: jet.String): Command? diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet72.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet72.txt new file mode 100644 index 0000000000000..0d868ac29e52b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet72.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal abstract class Item : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ room: java.lang.Object): Item + internal abstract val name: jet.String + internal final val room: java.lang.Object +} +internal final val items: java.util.ArrayList<Item> +internal final fun test(/*0*/ room: java.lang.Object): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/Jet81.txt b/compiler/testData/lazyResolve/diagnostics/regressions/Jet81.txt new file mode 100644 index 0000000000000..4a8d5b1db0dc4 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/Jet81.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final val A: A +internal final val a: <no name provided> +internal final val b: [ERROR : <ERROR PROPERTY TYPE>] +internal final val c: jet.Int +internal final val y: <no name provided> +internal final val z: [ERROR : Type for y] diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/OrphanStarProjection.txt b/compiler/testData/lazyResolve/diagnostics/regressions/OrphanStarProjection.txt new file mode 100644 index 0000000000000..b5ae30814e185 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/OrphanStarProjection.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class B : jet.Any { + public final /*constructor*/ fun <init>(): B +} +internal final val b: [ERROR : B<*>] diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/OutProjections.txt b/compiler/testData/lazyResolve/diagnostics/regressions/OutProjections.txt new file mode 100644 index 0000000000000..0e734f7d29c10 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/OutProjections.txt @@ -0,0 +1,15 @@ +namespace <root> + +internal final class G</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): G<T> +} +internal final class Out</*0*/ out T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ out T : jet.Any?><init>(): Out<T> +} +internal final class Point : jet.Any { + public final /*constructor*/ fun <init>(): Point +} +internal final fun </*0*/ T : jet.Any?>f(/*0*/ expression: T): G<out T> +internal final fun foo(): G<Point> +internal final fun fooout(): Out<Point> +internal final fun </*0*/ T : jet.Any?>fout(/*0*/ expression: T): Out<out T> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/OverrideResolution.txt b/compiler/testData/lazyResolve/diagnostics/regressions/OverrideResolution.txt new file mode 100644 index 0000000000000..fa981b347d6d7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/OverrideResolution.txt @@ -0,0 +1,15 @@ +namespace <root> + +internal open class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal open fun foo(): jet.Tuple0 +} +internal open class B : A { + public final /*constructor*/ fun <init>(): B + internal open override /*1*/ fun foo(): jet.Tuple0 +} +internal open class C : B { + public final /*constructor*/ fun <init>(): C + internal open override /*1*/ fun foo(): jet.Tuple0 +} +internal final fun box(/*0*/ c: C): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/SpecififcityByReceiver.txt b/compiler/testData/lazyResolve/diagnostics/regressions/SpecififcityByReceiver.txt new file mode 100644 index 0000000000000..4cd7eebe6393b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/SpecififcityByReceiver.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun jet.Any.equals(/*0*/ other: jet.Any?): jet.Boolean +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/TypeMismatchOnUnaryOperations.txt b/compiler/testData/lazyResolve/diagnostics/regressions/TypeMismatchOnUnaryOperations.txt new file mode 100644 index 0000000000000..dc622bf14c5ed --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/TypeMismatchOnUnaryOperations.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/TypeParameterAsASupertype.txt b/compiler/testData/lazyResolve/diagnostics/regressions/TypeParameterAsASupertype.txt new file mode 100644 index 0000000000000..2861640864159 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/TypeParameterAsASupertype.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final class A</*0*/ T : jet.Any?> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): A<T> +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/UnavaliableQualifiedThis.txt b/compiler/testData/lazyResolve/diagnostics/regressions/UnavaliableQualifiedThis.txt new file mode 100644 index 0000000000000..2a808d697c821 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/UnavaliableQualifiedThis.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal abstract trait Iterator</*0*/ out T : jet.Any?> : jet.Any { + internal abstract val hasNext: jet.Boolean + internal open fun </*0*/ R : jet.Any?>map(/*0*/ transform: jet.Function1<T, R>): Iterator<R> + internal abstract fun next(): T +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/WrongTraceInCallResolver.txt b/compiler/testData/lazyResolve/diagnostics/regressions/WrongTraceInCallResolver.txt new file mode 100644 index 0000000000000..b0b8e8d9c68cc --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/WrongTraceInCallResolver.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal open class Bar : jet.Any { + public final /*constructor*/ fun <init>(): Bar +} +internal open class Foo : jet.Any { + public final /*constructor*/ fun <init>(): Foo +} +internal final fun f(): jet.Tuple0 +internal final fun </*0*/ T : Bar, /*1*/ T1 : jet.Any?>foo(/*0*/ x: jet.Int): jet.Tuple0 +internal final fun </*0*/ T1 : jet.Any?, /*1*/ T : Foo>foo(/*0*/ x: jet.Long): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt127.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt127.txt new file mode 100644 index 0000000000000..52f7e7f8b5d33 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt127.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final class Foo : jet.Any { + public final /*constructor*/ fun <init>(): Foo +} +internal final fun jet.Any.equals(/*0*/ other: jet.Any?): jet.Boolean +internal final fun jet.Any?.equals1(/*0*/ other: jet.Any?): jet.Boolean +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt128.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt128.txt new file mode 100644 index 0000000000000..35ffbe62f0f23 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt128.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun div(/*0*/ c: jet.String = ?, /*1*/ f: jet.Function0<jet.Tuple0>): jet.Tuple0 +internal final fun f(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt1489_1728.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt1489_1728.txt new file mode 100644 index 0000000000000..ee4feff2a8e1e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt1489_1728.txt @@ -0,0 +1,21 @@ +namespace <root> + +// <namespace name="kt606_dependents"> +namespace kt606_dependents + +internal abstract trait kt606_dependents.AutoCloseable : jet.Any { + internal abstract fun close(): jet.Tuple0 +} +internal final class kt606_dependents.C : jet.Any { + public final /*constructor*/ fun <init>(): kt606_dependents.C + internal final fun bar(): jet.Tuple0 + internal final class kt606_dependents.C.Resource : kt606_dependents.AutoCloseable { + public final /*constructor*/ fun <init>(): kt606_dependents.C.Resource + internal open override /*1*/ fun close(): jet.Tuple0 + } + internal final fun </*0*/ X : kt606_dependents.AutoCloseable>foo(/*0*/ x: X, /*1*/ body: jet.Function1<X, jet.Tuple0>): jet.Tuple0 + internal final fun p(): kt606_dependents.C.Resource? +} +internal final val jet.Int.ext: jet.Function0<jet.Int> +internal final val x: jet.Int +// </namespace name="kt606_dependents"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt1550.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt1550.txt new file mode 100644 index 0000000000000..5ed3f291218f7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt1550.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="foo"> +namespace foo + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="foo"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt1647.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt1647.txt new file mode 100644 index 0000000000000..f1b4f3a8b7cb2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt1647.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal open class Abs : jet.Any { + public final /*constructor*/ fun <init>(): Abs +} +internal final class Bar : Abs { + public final /*constructor*/ fun <init>(): Bar +} +internal final fun </*0*/ F : Abs>patternMatchingAndGenerics(/*0*/ arg: F): jet.String diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt1736.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt1736.txt new file mode 100644 index 0000000000000..a986a0328df57 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt1736.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt1736"> +namespace kt1736 + +internal final val Obj: kt1736.Obj +internal final val x: jet.Tuple0 +// </namespace name="kt1736"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt174.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt174.txt new file mode 100644 index 0000000000000..047a3793ab71c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt174.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal abstract trait Tree : jet.Any { +} +internal final fun jet.Any?.TreeValue(): Tree diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt201.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt201.txt new file mode 100644 index 0000000000000..282c60847816d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt201.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun foo(): jet.Tuple0 +internal final fun </*0*/ T : jet.Any>T?.npe(): T diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt235.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt235.txt new file mode 100644 index 0000000000000..3e1f8c1ff935f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt235.txt @@ -0,0 +1,21 @@ +namespace <root> + +// <namespace name="kt235"> +namespace kt235 + +internal final class kt235.MyArray : jet.Any { + public final /*constructor*/ fun <init>(): kt235.MyArray + internal final fun get(/*0*/ i: jet.Int): jet.Int + internal final fun set(/*0*/ i: jet.Int, /*1*/ value: jet.Int): jet.Int +} +internal final class kt235.MyArray1 : jet.Any { + public final /*constructor*/ fun <init>(): kt235.MyArray1 + internal final fun get(/*0*/ i: jet.Int): jet.Int + internal final fun set(/*0*/ i: jet.Int, /*1*/ value: jet.Int): jet.Tuple0 +} +internal final class kt235.MyNumber : jet.Any { + public final /*constructor*/ fun <init>(): kt235.MyNumber + internal final fun inc(): kt235.MyNumber +} +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="kt235"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt2376.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt2376.txt new file mode 100644 index 0000000000000..d1101ee41311c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt2376.txt @@ -0,0 +1,7 @@ +namespace <root> + +public open class Test : java.lang.Object { + public final /*constructor*/ fun <init>(): Test + package open fun number(/*0*/ n: jet.Number?): jet.Tuple0 +} +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt251.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt251.txt new file mode 100644 index 0000000000000..d508ebfcc28cf --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt251.txt @@ -0,0 +1,13 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final var a: jet.Any + internal final val b: jet.Int + internal final val c: jet.Int + internal final val d: jet.Int + internal final val e: jet.Int + internal final var x: jet.Int + internal final val y: jet.Int + internal final val z: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt258.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt258.txt new file mode 100644 index 0000000000000..d8b05485691e2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt258.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun </*0*/ K : jet.Any?, /*1*/ V : jet.Any?>java.util.Map<K, V>.set(/*0*/ key: K, /*1*/ value: V): jet.Tuple0 +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt26.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt26.txt new file mode 100644 index 0000000000000..8cc56101dc614 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt26.txt @@ -0,0 +1,10 @@ +namespace <root> + +// <namespace name="html"> +namespace html + +internal abstract class html.Factory</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): html.Factory<T> + internal final fun create(): T? +} +// </namespace name="html"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt282.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt282.txt new file mode 100644 index 0000000000000..b4cf816c53369 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt282.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal final class Set : jet.Any { + public final /*constructor*/ fun <init>(): Set + internal final fun contains(/*0*/ x: jet.Int): jet.Boolean +} +internal final fun jet.Int?.contains(/*0*/ x: jet.Int): jet.Boolean +internal final fun f(): jet.Tuple0 +internal final fun Set?.plus(/*0*/ x: jet.Int): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt287.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt287.txt new file mode 100644 index 0000000000000..977f81dc7c0ea --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt287.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final val attributes: java.util.Map<jet.String, jet.String> +internal final fun attributes(): java.util.Map<jet.String, jet.String> +internal final fun foo(/*0*/ m: java.util.Map<jet.String, jet.String>): jet.Tuple0 +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt302.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt302.txt new file mode 100644 index 0000000000000..9ccb8bbc7b3b0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt302.txt @@ -0,0 +1,16 @@ +namespace <root> + +// <namespace name="kt302"> +namespace kt302 + +internal abstract trait kt302.A : jet.Any { + internal open fun foo(): jet.Tuple0 +} +internal abstract trait kt302.B : jet.Any { + internal open fun foo(): jet.Tuple0 +} +internal final class kt302.C : kt302.A, kt302.B { + public final /*constructor*/ fun <init>(): kt302.C + internal open override /*2*/ fun foo(): jet.Tuple0 +} +// </namespace name="kt302"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt306.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt306.txt new file mode 100644 index 0000000000000..1b83462abec04 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt306.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal final class Barr : jet.Any { + public final /*constructor*/ fun <init>(): Barr + internal final fun bar(): jet.Tuple0 +} +internal final class Foo : jet.Any { + public final /*constructor*/ fun <init>(): Foo + internal final fun bar(): jet.Tuple0 +} +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt307.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt307.txt new file mode 100644 index 0000000000000..9f982e8ca5677 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt307.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal open class AL : jet.Any { + public final /*constructor*/ fun <init>(): AL + internal final fun get(/*0*/ i: jet.Int): jet.Any? +} +internal abstract trait ALE</*0*/ T : jet.Any?> : AL { + internal final override /*1*/ fun get(/*0*/ i: jet.Int): jet.Any? + internal open fun getOrNull(/*0*/ index: jet.Int, /*1*/ value: T): T +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt312.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt312.txt new file mode 100644 index 0000000000000..c41c0e08376dc --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt312.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final val args: jet.Array<jet.String> +internal final val name: jet.String +internal final val name1: jet.String? +internal final fun </*0*/ T : jet.Any?>jet.Array<out T>.safeGet(/*0*/ index: jet.Int): T? diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt313.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt313.txt new file mode 100644 index 0000000000000..72bc183d98c02 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt313.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun </*0*/ T : jet.Any?>jet.Iterable<T>.join(/*0*/ separator: jet.String?): jet.String +internal final fun </*0*/ T : jet.Any>T?.npe(): T diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt316.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt316.txt new file mode 100644 index 0000000000000..a72a4477360ec --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt316.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal open class A : B { + public final /*constructor*/ fun <init>(): A + internal open override /*1*/ fun bar(): jet.Tuple0 + internal open override /*1*/ fun foo(): jet.Tuple0 +} +internal abstract trait B : jet.Any { + internal open fun bar(): jet.Tuple0 + internal open fun foo(): jet.Tuple0 +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt328.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt328.txt new file mode 100644 index 0000000000000..67e35484a7cd5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt328.txt @@ -0,0 +1,12 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final val x: jet.Function0<[ERROR : <return type>]> +} +internal final val x: jet.Function0<[ERROR : <return type>]> +internal final val z: [ERROR : Type for z] +internal final fun bar1(): jet.Function0<[ERROR : <return type>]> +internal final fun bar2(): jet.Function0<jet.Tuple0> +internal final fun bar3(): jet.Tuple0 +internal final fun block(/*0*/ f: jet.Function0<jet.Tuple0>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt335.336.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt335.336.txt new file mode 100644 index 0000000000000..da8169f6c277f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt335.336.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun </*0*/ T : jet.Any?>java.util.List<T>.plus(/*0*/ other: java.util.List<T>): java.util.List<T> +internal final fun </*0*/ T : java.lang.Comparable<T>>java.util.List<T>.sort(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt337.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt337.txt new file mode 100644 index 0000000000000..955e222056bb8 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt337.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final fun foo(): jet.Tuple0 +} +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt352.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt352.txt new file mode 100644 index 0000000000000..1597cca18151e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt352.txt @@ -0,0 +1,17 @@ +namespace <root> + +// <namespace name="kt352"> +namespace kt352 + +internal final class kt352.A : jet.Any { + public final /*constructor*/ fun <init>(): kt352.A + internal final val f: jet.Function1<jet.Any, jet.Tuple0> +} +internal final val f: jet.Function1<jet.Any, jet.Tuple0> +internal final val g: jet.Function0<jet.Tuple0> +internal final val h: jet.Function0<jet.Tuple0> +internal final val testIt: jet.Function1<jet.Any, jet.Tuple0> +internal final fun doSmth(): jet.Int +internal final fun doSmth(/*0*/ a: jet.String): jet.Tuple0 +internal final fun foo(): jet.Tuple0 +// </namespace name="kt352"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt353.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt353.txt new file mode 100644 index 0000000000000..a6b746fac2e83 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt353.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal abstract trait A : jet.Any { + internal abstract fun </*0*/ T : jet.Any?>gen(): T +} +internal final fun foo(/*0*/ a: A): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt385.109.441.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt385.109.441.txt new file mode 100644 index 0000000000000..2cbf0ee5a0fa1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt385.109.441.txt @@ -0,0 +1,12 @@ +namespace <root> + +internal final fun box(): jet.String +internal final fun </*0*/ T : jet.Any?>jet.Iterable<T>.foreach(/*0*/ operation: jet.Function1<T, jet.Tuple0>): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>jet.Iterable<T>.foreach(/*0*/ operation: jet.Function2<jet.Int, T, jet.Tuple0>): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>jet.Iterator<T>.foreach(/*0*/ operation: jet.Function1<T, jet.Tuple0>): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>jet.Iterator<T>.foreach(/*0*/ operation: jet.Function2<jet.Int, T, jet.Tuple0>): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>generic_invoker(/*0*/ gen: jet.Function0<T>): T +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun println(/*0*/ message: jet.Int): jet.Tuple0 +internal final fun println(/*0*/ message: jet.Long): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>run(/*0*/ body: jet.Function0<T>): T diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt398.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt398.txt new file mode 100644 index 0000000000000..dbe7a9bc4f8d1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt398.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class X</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): X<T> + internal final val check: jet.Function1<jet.Any, jet.Boolean> +} +internal final fun box(): jet.String diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt399.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt399.txt new file mode 100644 index 0000000000000..087509a18834e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt399.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun box(): jet.String +internal final fun </*0*/ T : jet.Any?>getSameTypeChecker(/*0*/ obj: T): jet.Function1<jet.Any, jet.Boolean> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt402.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt402.txt new file mode 100644 index 0000000000000..bef4752805fa7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt402.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt402"> +namespace kt402 + +internal final fun f(): jet.Function1<jet.Any, jet.Boolean> +internal final fun getTypeChecker(): jet.Function1<jet.Any, jet.Boolean> +// </namespace name="kt402"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt41.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt41.txt new file mode 100644 index 0000000000000..0fb842f2c66bf --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt41.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt41"> +namespace kt41 + +internal final fun aaa(): [ERROR : Error function type] +internal final fun bbb(): jet.Tuple0 +// </namespace name="kt41"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt411.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt411.txt new file mode 100644 index 0000000000000..ea60c1f0cd370 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt411.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt411"> +namespace kt411 + +internal final fun f(): jet.Tuple0 +internal final fun invoker(/*0*/ gen: jet.Function0<jet.Int>): jet.Int +internal final fun t1(): jet.Tuple0 +internal final fun t2(): jet.String +internal final fun t3(): jet.String +internal final fun t4(): jet.Int +// </namespace name="kt411"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt439.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt439.txt new file mode 100644 index 0000000000000..c35601905d8fd --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt439.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun main1(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>run1(/*0*/ body: jet.Function0<T>): T diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt442.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt442.txt new file mode 100644 index 0000000000000..ec55b504b9891 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt442.txt @@ -0,0 +1,10 @@ +namespace <root> + +internal final fun box(): jet.String +internal final fun </*0*/ T : jet.Any?>funny(/*0*/ f: jet.Function0<T>): T +internal final fun </*0*/ T : jet.Any?>funny2(/*0*/ f: jet.Function1<T, T>): T +internal final fun </*0*/ T : jet.Any?>generic_invoker(/*0*/ gen: jet.Function1<jet.String, T>): T +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun testFunny(): jet.Tuple0 +internal final fun testFunny2(): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>T.with(/*0*/ f: jet.ExtensionFunction0<T, jet.Tuple0>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt443.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt443.txt new file mode 100644 index 0000000000000..1d3ff8dddb04e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt443.txt @@ -0,0 +1,11 @@ +namespace <root> + +internal open class M : jet.Any { + public final /*constructor*/ fun <init>(): M + internal open val b: jet.Int +} +internal final class N : M { + public final /*constructor*/ fun <init>(): N + internal final val a: jet.Int + internal open override /*1*/ val b: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt455.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt455.txt new file mode 100644 index 0000000000000..decaf84711991 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt455.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt455"> +namespace kt455 + +internal final fun doSmth(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun foo(): jet.Tuple0 +// </namespace name="kt455"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt456.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt456.txt new file mode 100644 index 0000000000000..5e1da2e3112fb --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt456.txt @@ -0,0 +1,19 @@ +namespace <root> + +// <namespace name="kt456"> +namespace kt456 + +internal final class kt456.A : jet.Any { + public final /*constructor*/ fun <init>(): kt456.A + internal final val i: jet.Int +} +internal final class kt456.B : jet.Any { + public final /*constructor*/ fun <init>(): kt456.B + internal final val i: jet.Int +} +internal final class kt456.C : jet.Any { + public final /*constructor*/ fun <init>(): kt456.C + internal final val i: jet.Int +} +internal final fun doSmth(): jet.Tuple0 +// </namespace name="kt456"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt459.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt459.txt new file mode 100644 index 0000000000000..d8b05485691e2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt459.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun </*0*/ K : jet.Any?, /*1*/ V : jet.Any?>java.util.Map<K, V>.set(/*0*/ key: K, /*1*/ value: V): jet.Tuple0 +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt469.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt469.txt new file mode 100644 index 0000000000000..4ca0d641485a6 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt469.txt @@ -0,0 +1,14 @@ +namespace <root> + +// <namespace name="kt469"> +namespace kt469 + +internal final class kt469.MyNumber : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ i: jet.Int): kt469.MyNumber + internal final var i: jet.Int + internal final fun minusAssign(/*0*/ m: kt469.MyNumber): jet.Tuple0 +} +internal final fun bar(/*0*/ list: java.util.List<jet.Int>): jet.Tuple0 +internal final fun foo(): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>java.util.List<T>.plusAssign(/*0*/ t: T): jet.Tuple0 +// </namespace name="kt469"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt498.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt498.txt new file mode 100644 index 0000000000000..e17c5a9b5694d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt498.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal final class IdUnavailableException : java.lang.Exception { + public final /*constructor*/ fun <init>(): IdUnavailableException + public final override /*1*/ fun getCause(): jet.Throwable? + public final override /*1*/ fun getMessage(): jet.String? + public final override /*1*/ fun printStackTrace(): jet.Tuple0 +} +internal final fun </*0*/ T : jet.Any>T.getJavaClass(): java.lang.Class<T> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt524.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt524.txt new file mode 100644 index 0000000000000..5d8c9ce2cea2c --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt524.txt @@ -0,0 +1,10 @@ +namespace <root> + +// <namespace name="StringBuilder"> +namespace StringBuilder + +internal final val jet.Int.bd: java.lang.StringBuilder +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun java.lang.StringBuilder.plus(/*0*/ other: java.lang.StringBuilder): java.lang.StringBuilder +internal final fun </*0*/ T : jet.Any>T?.sure1(): T +// </namespace name="StringBuilder"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt526UnresolvedReferenceInnerStatic.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt526UnresolvedReferenceInnerStatic.txt new file mode 100644 index 0000000000000..219081851dfea --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt526UnresolvedReferenceInnerStatic.txt @@ -0,0 +1,19 @@ +namespace <root> + +// <namespace name="demo"> +namespace demo + +internal final class demo.Foo : jet.Any { + public final /*constructor*/ fun <init>(): demo.Foo + internal final object demo.Foo.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): demo.Foo.<no name provided> + internal final class demo.Foo.<no name provided>.Bar : jet.Any { + public final /*constructor*/ fun <init>(): demo.Foo.<no name provided>.Bar + } + } +} +internal final class demo.User : jet.Any { + public final /*constructor*/ fun <init>(): demo.User + internal final fun main(): jet.Tuple0 +} +// </namespace name="demo"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt549.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt549.txt new file mode 100644 index 0000000000000..f125786e17e11 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt549.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="demo"> +namespace demo + +internal final fun </*0*/ T : jet.Any?>filter(/*0*/ list: jet.Array<T>, /*1*/ filter: jet.Function1<T, jet.Boolean>): java.util.List<T> +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="demo"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt557.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt557.txt new file mode 100644 index 0000000000000..a26707c1a3c40 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt557.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun jet.Array<jet.String>.length(): jet.Int +internal final fun test(/*0*/ array: jet.Array<jet.String?>?): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt571.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt571.txt new file mode 100644 index 0000000000000..86a4a28757dd5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt571.txt @@ -0,0 +1,4 @@ +namespace <root> + +private final fun double(/*0*/ d: jet.Int): jet.Int +internal final fun </*0*/ T : jet.Any?, /*1*/ R : jet.Any?>let(/*0*/ t: T, /*1*/ body: jet.Function1<T, R>): R diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt58.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt58.txt new file mode 100644 index 0000000000000..f09add8b664f6 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt58.txt @@ -0,0 +1,15 @@ +namespace <root> + +// <namespace name="kt58"> +namespace kt58 + +internal final fun doSmth(/*0*/ i: jet.Int): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>lock(/*0*/ lock: java.util.concurrent.locks.Lock, /*1*/ body: jet.Function0<T>): T +internal final fun t1(): jet.Int +internal final fun t2(): jet.Int +internal final fun t3(): jet.Int +internal final fun t4(): jet.Int +internal final fun t5(): jet.Int +internal final fun t6(): jet.Int +internal final fun t7(): jet.Int +// </namespace name="kt58"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt580.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt580.txt new file mode 100644 index 0000000000000..131cc4f4c7016 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt580.txt @@ -0,0 +1,18 @@ +namespace <root> + +// <namespace name="whats"> +namespace whats + +// <namespace name="the"> +namespace the + +// <namespace name="difference"> +namespace difference + +internal final val </*0*/ T : jet.Any?> jet.Array<T>.lastIndex: jet.Int +internal final fun iarray(/*0*/ vararg a: jet.String /*jet.Array<jet.String>*/): jet.Array<jet.String> +internal final fun </*0*/ T : jet.Any?>jet.Array<T>.lastIndex(): jet.Int +internal final fun main(): jet.Tuple0 +// </namespace name="difference"> +// </namespace name="the"> +// </namespace name="whats"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt588.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt588.txt new file mode 100644 index 0000000000000..9824d5fcee301 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt588.txt @@ -0,0 +1,37 @@ +namespace <root> + +internal final class Test : java.lang.Thread { + public final /*constructor*/ fun <init>(): Test + public final override /*1*/ fun checkAccess(): jet.Tuple0 + public open override /*1*/ fun countStackFrames(): jet.Int + public open override /*1*/ fun destroy(): jet.Tuple0 + public open override /*1*/ fun getContextClassLoader(): java.lang.ClassLoader? + public open override /*1*/ fun getId(): jet.Long + public final override /*1*/ fun getName(): jet.String? + public final override /*1*/ fun getPriority(): jet.Int + public open override /*1*/ fun getStackTrace(): jet.Array<[ERROR : Unresolved java class: StackTraceElement]>? + public final override /*1*/ fun getThreadGroup(): [ERROR : Unresolved java class: ThreadGroup] + public open override /*1*/ fun interrupt(): jet.Tuple0 + invisible_fake final override /*1*/ var inheritableThreadLocals: java.lang.ThreadLocal.ThreadLocalMap? + invisible_fake final override /*1*/ var threadLocals: java.lang.ThreadLocal.ThreadLocalMap? + public final override /*1*/ fun isAlive(): jet.Boolean + public final override /*1*/ fun isDaemon(): jet.Boolean + public open override /*1*/ fun isInterrupted(): jet.Boolean + public final override /*1*/ fun join(): jet.Tuple0 + public final override /*1*/ fun join(/*0*/ p0: jet.Long): jet.Tuple0 + public final override /*1*/ fun join(/*0*/ p0: jet.Long, /*1*/ p1: jet.Int): jet.Tuple0 + public final override /*1*/ fun resume(): jet.Tuple0 + public open override /*1*/ fun run(): jet.Tuple0 + public open override /*1*/ fun setContextClassLoader(/*0*/ p0: java.lang.ClassLoader?): jet.Tuple0 + public final override /*1*/ fun setDaemon(/*0*/ p0: jet.Boolean): jet.Tuple0 + public final override /*1*/ fun setName(/*0*/ p0: jet.String?): jet.Tuple0 + public final override /*1*/ fun setPriority(/*0*/ p0: jet.Int): jet.Tuple0 + public open override /*1*/ fun start(): jet.Tuple0 + public final override /*1*/ fun stop(): jet.Tuple0 + public final override /*1*/ fun stop(/*0*/ p0: jet.Throwable?): jet.Tuple0 + public final override /*1*/ fun suspend(): jet.Tuple0 + internal final object Test.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): Test.<no name provided> + internal final fun init2(): jet.Tuple0 + } +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt597.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt597.txt new file mode 100644 index 0000000000000..e944d823e3b54 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt597.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun </*0*/ T : jet.Any?>jet.Array<T>?.get(/*0*/ i: jet.Int): T +internal final fun jet.Int?.inc(): jet.Int +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt600.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt600.txt new file mode 100644 index 0000000000000..dd05b09a9faf6 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt600.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final fun </*0*/ T : jet.Any>T?._sure(): T +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt604.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt604.txt new file mode 100644 index 0000000000000..f0952c956b356 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt604.txt @@ -0,0 +1,15 @@ +namespace <root> + +internal abstract trait ChannelPipeline : jet.Any { +} +internal abstract trait ChannelPipelineFactory : jet.Any { + internal abstract fun getPipeline(): ChannelPipeline +} +internal final class DefaultChannelPipeline : ChannelPipeline { + public final /*constructor*/ fun <init>(): DefaultChannelPipeline +} +internal final class StandardPipelineFactory : ChannelPipelineFactory { + public final /*constructor*/ fun <init>(/*0*/ config: jet.ExtensionFunction0<ChannelPipeline, jet.Tuple0>): StandardPipelineFactory + internal final val config: jet.ExtensionFunction0<ChannelPipeline, jet.Tuple0> + internal open override /*1*/ fun getPipeline(): ChannelPipeline +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt618.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt618.txt new file mode 100644 index 0000000000000..3ff11450de4ae --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt618.txt @@ -0,0 +1,15 @@ +namespace <root> + +// <namespace name="lol"> +namespace lol + +internal final class lol.B : jet.Any { + public final /*constructor*/ fun <init>(): lol.B + internal final fun divAssign(/*0*/ other: lol.B): jet.String + internal final fun minusAssign(/*0*/ other: lol.B): jet.String + internal final fun modAssign(/*0*/ other: lol.B): jet.String + internal final fun plusAssign(/*0*/ other: lol.B): jet.String + internal final fun timesAssign(/*0*/ other: lol.B): jet.String +} +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +// </namespace name="lol"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt629.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt629.txt new file mode 100644 index 0000000000000..c4af41b826e72 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt629.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="kt629"> +namespace kt629 + +internal final class kt629.A : jet.Any { + public final /*constructor*/ fun <init>(): kt629.A + internal final fun mod(/*0*/ other: kt629.A): kt629.A + internal final var p: jet.String +} +internal final fun box(): jet.Boolean +internal final fun box2(): jet.Boolean +// </namespace name="kt629"> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt630.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt630.txt new file mode 100644 index 0000000000000..6bc93b1f2744b --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt630.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final val s: jet.String +internal final val x: jet.String diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt688.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt688.txt new file mode 100644 index 0000000000000..0597951b0d403 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt688.txt @@ -0,0 +1,14 @@ +namespace <root> + +internal open class A : jet.Any { + public final /*constructor*/ fun <init>(): A +} +internal open class B : A { + public final /*constructor*/ fun <init>(): B + internal final fun b(): B +} +internal final class C : jet.Any { + public final /*constructor*/ fun <init>(): C + internal final fun </*0*/ T : jet.Any?>a(/*0*/ x: jet.Function1<T, T>, /*1*/ y: T): T + internal final val x: B +} diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt701.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt701.txt new file mode 100644 index 0000000000000..b4847e1c74a59 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt701.txt @@ -0,0 +1,11 @@ +namespace <root> + +public final class Throwables : jet.Any { + public final /*constructor*/ fun <init>(): Throwables + internal final object Throwables.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): Throwables.<no name provided> + public final fun </*0*/ X : jet.Throwable?>propagateIfInstanceOf(/*0*/ throwable: jet.Throwable?, /*1*/ declaredType: java.lang.Class<X?>?): jet.Tuple0 + public final fun propagateIfPossible(/*0*/ throwable: jet.Throwable?): jet.Tuple0 + } +} +internal final fun </*0*/ T : jet.Any?>getJavaClass(): java.lang.Class<T> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt716.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt716.txt new file mode 100644 index 0000000000000..bd191ad0fc62d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt716.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal final class TypeInfo</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): TypeInfo<T> +} +internal final fun </*0*/ T : jet.Any?>TypeInfo<T>.getJavaClass(): java.lang.Class<T> +internal final fun </*0*/ T : jet.Any?>getJavaClass(): java.lang.Class<T> +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 +internal final fun </*0*/ T : jet.Any?>typeinfo(): TypeInfo<T> diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt743.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt743.txt new file mode 100644 index 0000000000000..bf9c380a76d04 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt743.txt @@ -0,0 +1,9 @@ +namespace <root> + +internal final class List</*0*/ T : jet.Any?> : jet.Any { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ head: T, /*1*/ tail: List<T>? = ?): List<T> + internal final val head: T + internal final val tail: List<T>? +} +internal final fun </*0*/ T : jet.Any?>foo(/*0*/ t: T): T +internal final fun </*0*/ T : jet.Any?, /*1*/ Q : jet.Any?>List<T>.map(/*0*/ f: jet.Function1<T, Q>): List<T>? diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt750.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt750.txt new file mode 100644 index 0000000000000..dc622bf14c5ed --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt750.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt762.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt762.txt new file mode 100644 index 0000000000000..dc622bf14c5ed --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt762.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt847.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt847.txt new file mode 100644 index 0000000000000..70b47b23e1705 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt847.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun </*0*/ T : jet.Any?>T.mustBe(/*0*/ t: T): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/regressions/kt860.txt b/compiler/testData/lazyResolve/diagnostics/regressions/kt860.txt new file mode 100644 index 0000000000000..7d99e93722a59 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/regressions/kt860.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kotlin"> +namespace kotlin + +// <namespace name="util"> +namespace util + +internal final fun </*0*/ T : jet.Any?, /*1*/ U : java.util.Collection<in T>>jet.Iterator<T>.to(/*0*/ container: U): U +internal final fun </*0*/ T : jet.Any?>jet.Iterator<T>.toArrayList(): java.util.ArrayList<T> +// </namespace name="util"> +// </namespace name="kotlin"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/ImportFromCurrentWithDifferentName.txt b/compiler/testData/lazyResolve/diagnostics/scopes/ImportFromCurrentWithDifferentName.txt new file mode 100644 index 0000000000000..4ea07c437bbc0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/ImportFromCurrentWithDifferentName.txt @@ -0,0 +1,9 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final class a.A : jet.Any { + public final /*constructor*/ fun <init>(): a.A +} +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/ImportTwoTimes.txt b/compiler/testData/lazyResolve/diagnostics/scopes/ImportTwoTimes.txt new file mode 100644 index 0000000000000..b024e5ffd0869 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/ImportTwoTimes.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="weatherForecast"> +namespace weatherForecast + +internal final fun weatherToday(): jet.String +// </namespace name="weatherForecast"> +// <namespace name="myApp"> +namespace myApp + +internal final fun needUmbrella(): jet.Boolean +// </namespace name="myApp"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/ImportTwoTimesStar.txt b/compiler/testData/lazyResolve/diagnostics/scopes/ImportTwoTimesStar.txt new file mode 100644 index 0000000000000..b024e5ffd0869 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/ImportTwoTimesStar.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="weatherForecast"> +namespace weatherForecast + +internal final fun weatherToday(): jet.String +// </namespace name="weatherForecast"> +// <namespace name="myApp"> +namespace myApp + +internal final fun needUmbrella(): jet.Boolean +// </namespace name="myApp"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/ImportsUselessSimpleImport.txt b/compiler/testData/lazyResolve/diagnostics/scopes/ImportsUselessSimpleImport.txt new file mode 100644 index 0000000000000..ec5450c3f40c2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/ImportsUselessSimpleImport.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final val B: a.B +// </namespace name="a"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/initializerScopeOfExtensionProperty.txt b/compiler/testData/lazyResolve/diagnostics/scopes/initializerScopeOfExtensionProperty.txt new file mode 100644 index 0000000000000..87773d626bbdf --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/initializerScopeOfExtensionProperty.txt @@ -0,0 +1,25 @@ +namespace <root> + +// <namespace name="i"> +namespace i + +internal final class i.A : jet.Any { + public final /*constructor*/ fun <init>(): i.A + internal final val ii: jet.Int +} +internal final class i.C : jet.Any { + public final /*constructor*/ fun <init>(): i.C + internal final class i.C.D : jet.Any { + public final /*constructor*/ fun <init>(): i.C.D + } +} +internal final val i.C.bar: i.C.D +internal final val jet.String.bd: [ERROR : <ERROR FUNCTION RETURN TYPE>] +internal final val jet.String.bd1: jet.String +internal final val i.A.foo: [ERROR : Type for ii] +internal final val i.C.foo: i.C.D +internal final val i.A.foo1: jet.Int +internal final val i.C.foo1: i.C.D +internal final val </*0*/ T : jet.Any?> java.util.List<T>.length: [ERROR : Type for size()] +internal final val </*0*/ T : jet.Any?> java.util.List<T>.length1: jet.Int +// </namespace name="i"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1078.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1078.txt new file mode 100644 index 0000000000000..1b65f105bc8eb --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1078.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt1078"> +namespace kt1078 + +internal final class kt1078.B : jet.Any { + public final /*constructor*/ fun <init>(): kt1078.B + internal final fun bar(): jet.Boolean +} +internal final fun foo(): kt1078.B +internal final fun test(): kt1078.B +// </namespace name="kt1078"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1244.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1244.txt new file mode 100644 index 0000000000000..49560a42e0cff --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1244.txt @@ -0,0 +1,13 @@ +namespace <root> + +// <namespace name="kt1244"> +namespace kt1244 + +internal final class kt1244.A : jet.Any { + public final /*constructor*/ fun <init>(): kt1244.A + private final var a: jet.String +} +internal final class kt1244.B : jet.Any { + public final /*constructor*/ fun <init>(): kt1244.B +} +// </namespace name="kt1244"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1248.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1248.txt new file mode 100644 index 0000000000000..4054dfc25e0bd --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1248.txt @@ -0,0 +1,15 @@ +namespace <root> + +// <namespace name="kt1248"> +namespace kt1248 + +internal abstract trait kt1248.ParseResult</*0*/ out T : jet.Any?> : jet.Any { + public abstract val success: jet.Boolean + public abstract val value: T +} +internal final class kt1248.Success</*0*/ T : jet.Any?> : kt1248.ParseResult<T> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(/*0*/ value: T): kt1248.Success<T> + internal open override /*1*/ val success: jet.Boolean + internal open override /*1*/ val value: T +} +// </namespace name="kt1248"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt151.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt151.txt new file mode 100644 index 0000000000000..6b5055cfa2767 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt151.txt @@ -0,0 +1,38 @@ +namespace <root> + +// <namespace name="kt151"> +namespace kt151 + +internal open class kt151.A : jet.Any { + public final /*constructor*/ fun <init>(): kt151.A + protected open fun x(): jet.Tuple0 +} +internal final class kt151.B : kt151.A { + public final /*constructor*/ fun <init>(): kt151.B + protected open override /*1*/ fun x(): jet.Tuple0 +} +internal open class kt151.C : jet.Any { + public final /*constructor*/ fun <init>(): kt151.C + internal open fun foo(): jet.Tuple0 +} +internal final class kt151.D : kt151.C, kt151.T { + public final /*constructor*/ fun <init>(): kt151.D + protected open override /*2*/ fun foo(): jet.Tuple0 +} +internal final class kt151.E : kt151.C, kt151.T { + public final /*constructor*/ fun <init>(): kt151.E + internal open override /*2*/ fun foo(): jet.Tuple0 +} +internal final class kt151.F : kt151.C, kt151.T { + public final /*constructor*/ fun <init>(): kt151.F + private open override /*2*/ fun foo(): jet.Tuple0 +} +internal final class kt151.G : kt151.C, kt151.T { + public final /*constructor*/ fun <init>(): kt151.G + public open override /*2*/ fun foo(): jet.Tuple0 +} +internal abstract trait kt151.T : jet.Any { + protected open fun foo(): jet.Tuple0 +} +internal final fun test(/*0*/ b: kt151.B): jet.Tuple0 +// </namespace name="kt151"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1579_map_entry.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1579_map_entry.txt new file mode 100644 index 0000000000000..cc98a11c4fbaf --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1579_map_entry.txt @@ -0,0 +1,17 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +internal final fun foo(/*0*/ b: java.util.Map.Entry<jet.String, jet.String>): java.util.Map.Entry<jet.String, jet.String> +// </namespace name="a"> +// <namespace name="b"> +namespace b + +internal final fun bar(/*0*/ b: java.util.Map.Entry<jet.String, jet.String>): java.util.Map.Entry<jet.String, jet.String> +// </namespace name="b"> +// <namespace name="c"> +namespace c + +internal final fun fff(/*0*/ b: java.util.Map.Entry<jet.String, jet.String>): java.util.Map.Entry<jet.String, jet.String> +// </namespace name="c"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1580.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1580.txt new file mode 100644 index 0000000000000..67c598ce182ca --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1580.txt @@ -0,0 +1,15 @@ +namespace <root> + +// <namespace name="lib"> +namespace lib + +internal abstract trait lib.WithInner : jet.Any { + internal abstract trait lib.WithInner.Inner : jet.Any { + } +} +// </namespace name="lib"> +// <namespace name="user"> +namespace user + +internal final fun main(/*0*/ a: lib.WithInner, /*1*/ b: lib.WithInner.Inner): jet.Tuple0 +// </namespace name="user"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1738.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1738.txt new file mode 100644 index 0000000000000..809fc1501c569 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1738.txt @@ -0,0 +1,12 @@ +namespace <root> + +// <namespace name="kt1738"> +namespace kt1738 + +internal final class kt1738.A : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ i: jet.Int, /*1*/ j: jet.Int): kt1738.A + private final var i: jet.Int + internal final var j: jet.Int +} +internal final fun test(/*0*/ a: kt1738.A): jet.Tuple0 +// </namespace name="kt1738"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1805.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1805.txt new file mode 100644 index 0000000000000..1d2552ad448e7 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1805.txt @@ -0,0 +1,16 @@ +namespace <root> + +// <namespace name="kt1805"> +namespace kt1805 + +internal open class kt1805.Some : jet.Any { + public final /*constructor*/ fun <init>(): kt1805.Some + private final val privateField: jet.Int +} +internal final class kt1805.SomeSubclass : kt1805.Some { + public final /*constructor*/ fun <init>(): kt1805.SomeSubclass + invisible_fake final override /*1*/ val privateField: jet.Int private get + internal final fun test(): jet.Tuple0 +} +internal final fun test(): jet.Tuple0 +// </namespace name="kt1805"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1806.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1806.txt new file mode 100644 index 0000000000000..6b3e7850ff04f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1806.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="kt1806"> +namespace kt1806 + +internal final val MyObject: kt1806.MyObject +internal final val MyObject1: kt1806.<no name provided> +internal final fun doSmth(/*0*/ s: jet.String): jet.String +internal final fun test1(): jet.Tuple0 +internal final fun test2(): jet.Tuple0 +// </namespace name="kt1806"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt1822.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt1822.txt new file mode 100644 index 0000000000000..42a10a651edb5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt1822.txt @@ -0,0 +1,31 @@ +namespace <root> + +// <namespace name="kt1822"> +namespace kt1822 + +internal open class kt1822.A : jet.Any { + public final /*constructor*/ fun <init>(): kt1822.A + internal open fun foo(): jet.Tuple0 +} +internal abstract trait kt1822.B : jet.Any { + protected open fun foo(): jet.Tuple0 +} +internal open class kt1822.C : jet.Any { + public final /*constructor*/ fun <init>(): kt1822.C + internal open fun foo(): jet.Tuple0 +} +internal abstract trait kt1822.D : jet.Any { + public open fun foo(): jet.Tuple0 +} +internal final class kt1822.E : kt1822.A, kt1822.B, kt1822.D { + public final /*constructor*/ fun <init>(): kt1822.E + public open override /*3*/ fun foo(): jet.Tuple0 +} +internal final class kt1822.G : kt1822.C, kt1822.T { + public final /*constructor*/ fun <init>(): kt1822.G + public open override /*2*/ fun foo(): jet.Tuple0 +} +internal abstract trait kt1822.T : jet.Any { + protected open fun foo(): jet.Tuple0 +} +// </namespace name="kt1822"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt2262.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt2262.txt new file mode 100644 index 0000000000000..4a824be7d0468 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt2262.txt @@ -0,0 +1,20 @@ +namespace <root> + +// <namespace name="kt2262"> +namespace kt2262 + +internal final class kt2262.Bar : kt2262.Foo { + public final /*constructor*/ fun <init>(): kt2262.Bar + internal final class kt2262.Bar.Baz : jet.Any { + public final /*constructor*/ fun <init>(): kt2262.Bar.Baz + internal final val copy: jet.String + internal final val j: jet.Int + } + protected final override /*1*/ val color: jet.String + protected final val i: jet.Int +} +internal abstract class kt2262.Foo : jet.Any { + public final /*constructor*/ fun <init>(): kt2262.Foo + protected final val color: jet.String +} +// </namespace name="kt2262"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt323.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt323.txt new file mode 100644 index 0000000000000..654e871d558c4 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt323.txt @@ -0,0 +1,16 @@ +namespace <root> + +// <namespace name="kt323"> +namespace kt323 + +internal open class kt323.A : jet.Any { + public final /*constructor*/ fun <init>(): kt323.A + internal open var a: jet.Int +} +internal final class kt323.B : kt323.A { + public final /*constructor*/ fun <init>(): kt323.B + internal open override /*1*/ val a: jet.Int + internal final var b: jet.Int public get + protected final var c: jet.Int private set +} +// </namespace name="kt323"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt37.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt37.txt new file mode 100644 index 0000000000000..71ec1ae45c0a0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt37.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="kt37"> +namespace kt37 + +internal final class kt37.C : jet.Any { + public final /*constructor*/ fun <init>(): kt37.C + private final var f: jet.Int +} +internal final fun box(): jet.String +// </namespace name="kt37"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt421Scopes.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt421Scopes.txt new file mode 100644 index 0000000000000..625a507c5a387 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt421Scopes.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(): A + internal final val a: jet.Int + internal final val b: jet.Int + internal final val c: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt587.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt587.txt new file mode 100644 index 0000000000000..9cd8a83d3ab11 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt587.txt @@ -0,0 +1,15 @@ +namespace <root> + +internal final class Main : jet.Any { + public final /*constructor*/ fun <init>(): Main + internal final object Main.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): Main.<no name provided> + internal final class Main.<no name provided>.States : jet.Any { + public final /*constructor*/ fun <init>(): Main.<no name provided>.States + internal final object Main.<no name provided>.States.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): Main.<no name provided>.States.<no name provided> + public final val N: Main.<no name provided>.States + } + } + } +} diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt900-1.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt900-1.txt new file mode 100644 index 0000000000000..a2782c768468d --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt900-1.txt @@ -0,0 +1,20 @@ +namespace <root> + +// <namespace name="c"> +namespace c + +internal final class c.A : jet.Any { + public final /*constructor*/ fun <init>(): c.A + internal final object c.A.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): c.A.<no name provided> + internal final class c.A.<no name provided>.B : jet.Any { + public final /*constructor*/ fun <init>(): c.A.<no name provided>.B + internal final object c.A.<no name provided>.B.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): c.A.<no name provided>.B.<no name provided> + } + } + } +} +internal final val M: c.M +internal final fun foo(): jet.Tuple0 +// </namespace name="c"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt900-2.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt900-2.txt new file mode 100644 index 0000000000000..cc2773f8e563a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt900-2.txt @@ -0,0 +1,11 @@ +namespace <root> + +// <namespace name="d"> +namespace d + +internal final val A: d.A +internal final val M: d.M +internal final var r: d.M.T +internal final val y: d.M.T +internal final fun f(): jet.Tuple0 +// </namespace name="d"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/kt939.txt b/compiler/testData/lazyResolve/diagnostics/scopes/kt939.txt new file mode 100644 index 0000000000000..d3b6a63b4acd5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/kt939.txt @@ -0,0 +1,8 @@ +namespace <root> + +// <namespace name="kt939"> +namespace kt939 + +internal final fun compare(/*0*/ o1: jet.String?, /*1*/ o2: jet.String?): jet.Int +internal final fun test(): jet.Tuple0 +// </namespace name="kt939"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/stopResolutionOnAmbiguity.txt b/compiler/testData/lazyResolve/diagnostics/scopes/stopResolutionOnAmbiguity.txt new file mode 100644 index 0000000000000..ded0f368884a5 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/stopResolutionOnAmbiguity.txt @@ -0,0 +1,15 @@ +namespace <root> + +// <namespace name="c"> +namespace c + +internal abstract trait c.B : jet.Any { + internal open fun bar(): jet.Tuple0 +} +internal final class c.C : jet.Any { + public final /*constructor*/ fun <init>(): c.C + internal final fun bar(): jet.Tuple0 +} +internal final fun jet.Any?.bar(): jet.Tuple0 +internal final fun test(/*0*/ a: jet.Any?): jet.Tuple0 +// </namespace name="c"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/visibility.txt b/compiler/testData/lazyResolve/diagnostics/scopes/visibility.txt new file mode 100644 index 0000000000000..977bda3f9d270 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/visibility.txt @@ -0,0 +1,71 @@ +namespace <root> + +// <namespace name="test_visibility"> +namespace test_visibility + +internal final class test_visibility.A : jet.Any { + public final /*constructor*/ fun <init>(): test_visibility.A + private final fun f(/*0*/ i: jet.Int): test_visibility.B + private final val i: jet.Int + internal final fun test(): jet.Tuple0 + private final val v: test_visibility.B +} +internal final class test_visibility.B : jet.Any { + public final /*constructor*/ fun <init>(): test_visibility.B + internal final fun bMethod(): jet.Tuple0 +} +internal open class test_visibility.C : test_visibility.T { + public final /*constructor*/ fun <init>(): test_visibility.C + protected final var i: jet.Int + internal final fun test5(): jet.Tuple0 +} +internal final class test_visibility.D : test_visibility.C { + public final /*constructor*/ fun <init>(): test_visibility.D + protected final override /*1*/ var i: jet.Int + internal final val j: jet.Int + internal final override /*1*/ fun test5(): jet.Tuple0 + internal final fun test6(): jet.Tuple0 +} +internal final class test_visibility.E : test_visibility.C { + public final /*constructor*/ fun <init>(): test_visibility.E + protected final override /*1*/ var i: jet.Int + internal final override /*1*/ fun test5(): jet.Tuple0 + internal final fun test7(): jet.Tuple0 +} +internal final class test_visibility.F : test_visibility.C { + public final /*constructor*/ fun <init>(): test_visibility.F + protected final override /*1*/ var i: jet.Int + internal final override /*1*/ fun test5(): jet.Tuple0 + internal final fun test8(/*0*/ c: test_visibility.C): jet.Tuple0 +} +internal final class test_visibility.G : test_visibility.T { + public final /*constructor*/ fun <init>(): test_visibility.G + internal final fun test8(/*0*/ c: test_visibility.C): jet.Tuple0 +} +protected final class test_visibility.ProtectedClass : jet.Any { + public final /*constructor*/ fun <init>(): test_visibility.ProtectedClass +} +protected abstract trait test_visibility.ProtectedTrait : jet.Any { +} +internal abstract trait test_visibility.T : jet.Any { +} +internal final class test_visibility.Y : jet.Any { + public final /*constructor*/ fun <init>(): test_visibility.Y + internal final fun test2(): jet.Tuple0 +} +internal final val internal_val: jet.Int +private final val private_val: jet.Int +protected final val protected_val: jet.Int +internal final fun doSmth(/*0*/ i: jet.Int): jet.Int +internal final fun internal_fun(): jet.Tuple0 +private final fun private_fun(): jet.Tuple0 +protected final fun protected_fun(): jet.Tuple0 +internal final fun test1(): jet.Tuple0 +internal final fun test3(/*0*/ a: test_visibility.A): jet.Tuple0 +internal final fun test4(/*0*/ c: test_visibility.C): jet.Tuple0 +// </namespace name="test_visibility"> +// <namespace name="test_visibility2"> +namespace test_visibility2 + +internal final fun test(): jet.Tuple0 +// </namespace name="test_visibility2"> diff --git a/compiler/testData/lazyResolve/diagnostics/scopes/visibility2.txt b/compiler/testData/lazyResolve/diagnostics/scopes/visibility2.txt new file mode 100644 index 0000000000000..c7a1fef0d2996 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/scopes/visibility2.txt @@ -0,0 +1,59 @@ +namespace <root> + +// <namespace name="a"> +namespace a + +private open class a.A : jet.Any { + public final /*constructor*/ fun <init>(): a.A + internal final fun bar(): jet.Tuple0 +} +private final val PO: a.PO +private final fun foo(): jet.Tuple0 +internal final fun makeA(): a.A +// </namespace name="a"> +// <namespace name="b"> +namespace b + +internal final class b.B : a.A { + public final /*constructor*/ fun <init>(): b.B + invisible_fake final override /*1*/ fun bar(): jet.Tuple0 +} +internal final class b.NewClass : java.util.ArrayList<java.lang.Integer> { + public final /*constructor*/ fun <init>(): b.NewClass + public open override /*1*/ fun add(/*0*/ p0: java.lang.Integer): jet.Boolean + public open override /*1*/ fun add(/*0*/ p0: jet.Int, /*1*/ p1: java.lang.Integer): jet.Tuple0 + public open override /*1*/ fun addAll(/*0*/ p0: java.util.Collection<out java.lang.Integer>): jet.Boolean + public open override /*1*/ fun addAll(/*0*/ p0: jet.Int, /*1*/ p1: java.util.Collection<out java.lang.Integer>): jet.Boolean + public open override /*1*/ fun clear(): jet.Tuple0 + public open override /*1*/ fun contains(/*0*/ p0: jet.Any?): jet.Boolean + public open override /*1*/ fun containsAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + public open override /*1*/ fun ensureCapacity(/*0*/ p0: jet.Int): jet.Tuple0 + public open override /*1*/ fun get(/*0*/ p0: jet.Int): java.lang.Integer + public open override /*1*/ fun indexOf(/*0*/ p0: jet.Any?): jet.Int + public open override /*1*/ fun isEmpty(): jet.Boolean + public open override /*1*/ fun iterator(): java.util.Iterator<java.lang.Integer> + public open override /*1*/ fun lastIndexOf(/*0*/ p0: jet.Any?): jet.Int + public open override /*1*/ fun listIterator(): java.util.ListIterator<java.lang.Integer> + public open override /*1*/ fun listIterator(/*0*/ p0: jet.Int): java.util.ListIterator<java.lang.Integer> + protected final override /*1*/ var modCount: jet.Int + public open override /*1*/ fun remove(/*0*/ p0: jet.Any?): jet.Boolean + public open override /*1*/ fun remove(/*0*/ p0: jet.Int): java.lang.Integer + public open override /*1*/ fun removeAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + protected open override /*1*/ fun removeRange(/*0*/ p0: jet.Int, /*1*/ p1: jet.Int): jet.Tuple0 + public open override /*1*/ fun retainAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + public open override /*1*/ fun set(/*0*/ p0: jet.Int, /*1*/ p1: java.lang.Integer): java.lang.Integer + public open override /*1*/ fun size(): jet.Int + public open override /*1*/ fun subList(/*0*/ p0: jet.Int, /*1*/ p1: jet.Int): java.util.List<java.lang.Integer> + public open override /*1*/ fun toArray(): jet.Array<jet.Any?> + public open override /*1*/ fun </*0*/ T : jet.Any?>toArray(/*0*/ p0: jet.Array<T>): jet.Array<T> + public open override /*1*/ fun trimToSize(): jet.Tuple0 +} +internal final class b.Q : jet.Any { + public final /*constructor*/ fun <init>(): b.Q + internal final class b.Q.W : jet.Any { + public final /*constructor*/ fun <init>(): b.Q.W + internal final fun foo(): jet.Tuple0 + } +} +internal final fun test(): jet.Tuple0 +// </namespace name="b"> diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowParameterInFunctionBody.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowParameterInFunctionBody.txt new file mode 100644 index 0000000000000..3c8b106de7b4e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowParameterInFunctionBody.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun f(/*0*/ p: jet.Int): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowParameterInNestedBlockInFor.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowParameterInNestedBlockInFor.txt new file mode 100644 index 0000000000000..44d0ba473256f --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowParameterInNestedBlockInFor.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun f(/*0*/ i: jet.Int): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInClosure.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInClosure.txt new file mode 100644 index 0000000000000..9e3751a0ccfed --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInClosure.txt @@ -0,0 +1,4 @@ +namespace <root> + +internal final val f: jet.Function0<jet.Int> +internal final val i: jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInFor.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInFor.txt new file mode 100644 index 0000000000000..8208812b6e320 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInFor.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class RedefinePropertyInFor : jet.Any { + public final /*constructor*/ fun <init>(): RedefinePropertyInFor + internal final fun ff(): jet.Tuple0 + internal final var i: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInFunction.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInFunction.txt new file mode 100644 index 0000000000000..9990bd4c6a941 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowPropertyInFunction.txt @@ -0,0 +1,7 @@ +namespace <root> + +internal final class RedefinePropertyInFunction : jet.Any { + public final /*constructor*/ fun <init>(): RedefinePropertyInFunction + internal final fun f(): jet.Int + internal final var i: jet.Int +} diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInFor.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInFor.txt new file mode 100644 index 0000000000000..d7faa630170d3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInFor.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedBlock.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedBlock.txt new file mode 100644 index 0000000000000..d7faa630170d3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedBlock.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedClosure.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedClosure.txt new file mode 100644 index 0000000000000..5d7114f2eee24 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedClosure.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun f(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedClosureParam.txt b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedClosureParam.txt new file mode 100644 index 0000000000000..d7faa630170d3 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/shadowing/ShadowVariableInNestedClosureParam.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun ff(): jet.Int diff --git a/compiler/testData/lazyResolve/diagnostics/substitutions/kt1558-short.txt b/compiler/testData/lazyResolve/diagnostics/substitutions/kt1558-short.txt new file mode 100644 index 0000000000000..3e4365ff960ea --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/substitutions/kt1558-short.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun testArrays(/*0*/ ci: java.util.List<jet.Int>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/subtyping/kt-1457.txt b/compiler/testData/lazyResolve/diagnostics/subtyping/kt-1457.txt new file mode 100644 index 0000000000000..4e199aaf64d42 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/subtyping/kt-1457.txt @@ -0,0 +1,33 @@ +namespace <root> + +internal final class MyListOfPairs</*0*/ T : jet.Any?> : java.util.ArrayList<jet.Tuple2<out T, out T>> { + public final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): MyListOfPairs<T> + public open override /*1*/ fun add(/*0*/ p0: jet.Int, /*1*/ p1: jet.Tuple2<out T, out T>): jet.Tuple0 + public open override /*1*/ fun add(/*0*/ p0: jet.Tuple2<out T, out T>): jet.Boolean + public open override /*1*/ fun addAll(/*0*/ p0: java.util.Collection<out jet.Tuple2<out T, out T>>): jet.Boolean + public open override /*1*/ fun addAll(/*0*/ p0: jet.Int, /*1*/ p1: java.util.Collection<out jet.Tuple2<out T, out T>>): jet.Boolean + public open override /*1*/ fun clear(): jet.Tuple0 + public open override /*1*/ fun contains(/*0*/ p0: jet.Any?): jet.Boolean + public open override /*1*/ fun containsAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + public open override /*1*/ fun ensureCapacity(/*0*/ p0: jet.Int): jet.Tuple0 + public open override /*1*/ fun get(/*0*/ p0: jet.Int): jet.Tuple2<out T, out T> + public open override /*1*/ fun indexOf(/*0*/ p0: jet.Any?): jet.Int + public open override /*1*/ fun isEmpty(): jet.Boolean + public open override /*1*/ fun iterator(): java.util.Iterator<jet.Tuple2<out T, out T>> + public open override /*1*/ fun lastIndexOf(/*0*/ p0: jet.Any?): jet.Int + public open override /*1*/ fun listIterator(): java.util.ListIterator<jet.Tuple2<out T, out T>> + public open override /*1*/ fun listIterator(/*0*/ p0: jet.Int): java.util.ListIterator<jet.Tuple2<out T, out T>> + protected final override /*1*/ var modCount: jet.Int + public open override /*1*/ fun remove(/*0*/ p0: jet.Any?): jet.Boolean + public open override /*1*/ fun remove(/*0*/ p0: jet.Int): jet.Tuple2<out T, out T> + public open override /*1*/ fun removeAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + protected open override /*1*/ fun removeRange(/*0*/ p0: jet.Int, /*1*/ p1: jet.Int): jet.Tuple0 + public open override /*1*/ fun retainAll(/*0*/ p0: java.util.Collection<out jet.Any?>): jet.Boolean + public open override /*1*/ fun set(/*0*/ p0: jet.Int, /*1*/ p1: jet.Tuple2<out T, out T>): jet.Tuple2<out T, out T> + public open override /*1*/ fun size(): jet.Int + public open override /*1*/ fun subList(/*0*/ p0: jet.Int, /*1*/ p1: jet.Int): java.util.List<jet.Tuple2<out T, out T>> + public open override /*1*/ fun toArray(): jet.Array<jet.Any?> + public open override /*1*/ fun </*0*/ T : jet.Any?>toArray(/*0*/ p0: jet.Array<T>): jet.Array<T> + public open override /*1*/ fun trimToSize(): jet.Tuple0 +} +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/subtyping/kt2069.txt b/compiler/testData/lazyResolve/diagnostics/subtyping/kt2069.txt new file mode 100644 index 0000000000000..f3b6159f0df0e --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/subtyping/kt2069.txt @@ -0,0 +1,17 @@ +namespace <root> + +// <namespace name="kt2069"> +namespace kt2069 + +internal final class kt2069.T : kt2069.T1 { + public final /*constructor*/ fun <init>(): kt2069.T + internal final fun bar(): jet.Tuple0 + internal open override /*1*/ fun foo(): jet.Tuple0 + internal final object kt2069.T.<no name provided> : jet.Any { + internal final /*constructor*/ fun <init>(): kt2069.T.<no name provided> + } +} +internal abstract trait kt2069.T1 : jet.Any { + internal open fun foo(): jet.Tuple0 +} +// </namespace name="kt2069"> diff --git a/compiler/testData/lazyResolve/diagnostics/tuples/BasicTuples.txt b/compiler/testData/lazyResolve/diagnostics/tuples/BasicTuples.txt new file mode 100644 index 0000000000000..d4170907a0bc6 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/tuples/BasicTuples.txt @@ -0,0 +1,3 @@ +namespace <root> + +internal final fun foo(/*0*/ a: jet.Tuple2<out jet.Int, out jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/AmbiguousVararg.txt b/compiler/testData/lazyResolve/diagnostics/varargs/AmbiguousVararg.txt new file mode 100644 index 0000000000000..9ae417d42d909 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/AmbiguousVararg.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun foo(/*0*/ vararg t: jet.Int /*jet.IntArray*/): jet.String +internal final fun foo(/*0*/ vararg t: jet.String /*jet.Array<jet.String>*/): jet.String +internal final fun test(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/MoreSpecificVarargsOfEqualLength.txt b/compiler/testData/lazyResolve/diagnostics/varargs/MoreSpecificVarargsOfEqualLength.txt new file mode 100644 index 0000000000000..f586865c7fb7a --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/MoreSpecificVarargsOfEqualLength.txt @@ -0,0 +1,8 @@ +namespace <root> + +internal final class D : jet.Any { + public final /*constructor*/ fun <init>(): D + internal final fun from(/*0*/ vararg a: jet.Any /*jet.Array<jet.Any>*/): jet.Tuple0 + internal final fun from(/*0*/ vararg a: jet.String /*jet.Array<jet.String>*/): jet.Tuple0 +} +internal final fun main(/*0*/ d: D): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/MostSepcificVarargsWithJava.txt b/compiler/testData/lazyResolve/diagnostics/varargs/MostSepcificVarargsWithJava.txt new file mode 100644 index 0000000000000..1f37d7bfc50b0 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/MostSepcificVarargsWithJava.txt @@ -0,0 +1,11 @@ +namespace <root> + +public open class C : java.lang.Object { + public final /*constructor*/ fun <init>(): C + package open fun from(): jet.Tuple0 + package open fun from(/*0*/ s1: jet.String?, /*1*/ vararg s: jet.String? /*jet.Array<jet.String?>*/): jet.Tuple0 + package open fun from(/*0*/ s: jet.String?): jet.Tuple0 + package open fun from(/*0*/ s: jet.String?, /*1*/ s1: jet.String?): jet.Tuple0 + package open fun from(/*0*/ vararg s: jet.String? /*jet.Array<jet.String?>*/): jet.Tuple0 +} +internal final fun main(/*0*/ j: C, /*1*/ s: jet.Array<jet.String?>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/NilaryVsVararg.txt b/compiler/testData/lazyResolve/diagnostics/varargs/NilaryVsVararg.txt new file mode 100644 index 0000000000000..f996f8debcbb1 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/NilaryVsVararg.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun foo0(): jet.String +internal final fun foo0(/*0*/ vararg t: jet.Int /*jet.IntArray*/): jet.String +internal final fun test0(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/UnaryVsVararg.txt b/compiler/testData/lazyResolve/diagnostics/varargs/UnaryVsVararg.txt new file mode 100644 index 0000000000000..a2a5212852fad --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/UnaryVsVararg.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final fun foo1(/*0*/ a: jet.Int): jet.String +internal final fun foo1(/*0*/ a: jet.Int, /*1*/ vararg t: jet.Int /*jet.IntArray*/): jet.String +internal final fun test1(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/kt1781.txt b/compiler/testData/lazyResolve/diagnostics/varargs/kt1781.txt new file mode 100644 index 0000000000000..eb653699101be --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/kt1781.txt @@ -0,0 +1,7 @@ +namespace <root> + +public open class JavaClass : java.lang.Object { + public final /*constructor*/ fun <init>(): JavaClass + public final /*constructor*/ fun <init>(/*0*/ vararg ss: jet.String? /*jet.Array<jet.String?>*/): JavaClass +} +internal final fun foo(): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/kt1835.txt b/compiler/testData/lazyResolve/diagnostics/varargs/kt1835.txt new file mode 100644 index 0000000000000..39182329abd27 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/kt1835.txt @@ -0,0 +1,8 @@ +namespace <root> + +public open class JavaClass : java.lang.Object { + public final /*constructor*/ fun <init>(): JavaClass + package open fun from(/*0*/ s: jet.String?): jet.Tuple0 + package open fun from(/*0*/ vararg s: jet.String? /*jet.Array<jet.String?>*/): jet.Tuple0 +} +internal final fun main(/*0*/ args: jet.Array<jet.String>): jet.Tuple0 diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/kt1838-param.txt b/compiler/testData/lazyResolve/diagnostics/varargs/kt1838-param.txt new file mode 100644 index 0000000000000..b0f8c7c49f3d2 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/kt1838-param.txt @@ -0,0 +1,5 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ vararg t: jet.Int /*jet.IntArray*/): A +} diff --git a/compiler/testData/lazyResolve/diagnostics/varargs/kt1838-val.txt b/compiler/testData/lazyResolve/diagnostics/varargs/kt1838-val.txt new file mode 100644 index 0000000000000..cae074c94a972 --- /dev/null +++ b/compiler/testData/lazyResolve/diagnostics/varargs/kt1838-val.txt @@ -0,0 +1,6 @@ +namespace <root> + +internal final class A : jet.Any { + public final /*constructor*/ fun <init>(/*0*/ vararg t: jet.Int /*jet.IntArray*/): A + internal final val t: jet.IntArray +} diff --git a/compiler/tests/org/jetbrains/jet/checkers/AbstractDiagnosticsTestWithEagerResolve.java b/compiler/tests/org/jetbrains/jet/checkers/AbstractDiagnosticsTestWithEagerResolve.java index 77b940858ad37..00c5f0ae8985c 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/AbstractDiagnosticsTestWithEagerResolve.java +++ b/compiler/tests/org/jetbrains/jet/checkers/AbstractDiagnosticsTestWithEagerResolve.java @@ -37,7 +37,8 @@ */ public abstract class AbstractDiagnosticsTestWithEagerResolve extends AbstractJetDiagnosticsTest { - protected void analyzeAndCheck(String expectedText, List<TestFile> testFiles) { + @Override + protected void analyzeAndCheck(File testDataFile, String expectedText, List<TestFile> testFiles) { List<JetFile> jetFiles = getJetFiles(testFiles); BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration( diff --git a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java index 224b863d6a397..5bf46e99695b9 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java @@ -86,10 +86,10 @@ public TestFile create(String fileName, String text) { getEnvironment().addToClasspath(javaFilesDir); } - analyzeAndCheck(expectedText, testFiles); + analyzeAndCheck(file, expectedText, testFiles); } - protected abstract void analyzeAndCheck(String expectedText, List<TestFile> files); + protected abstract void analyzeAndCheck(File testDataFile, String expectedText, List<TestFile> files); protected static List<JetFile> getJetFiles(List<TestFile> testFiles) { List<JetFile> jetFiles = Lists.newArrayList(); diff --git a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyResolveDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyResolveDiagnosticsTest.java index 72a492a53e876..5be6dfd47c316 100644 --- a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyResolveDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyResolveDiagnosticsTest.java @@ -16,15 +16,18 @@ package org.jetbrains.jet.lang.resolve.lazy; -import com.google.common.base.Predicates; +import com.google.common.base.Predicate; +import com.intellij.openapi.util.io.FileUtil; import junit.framework.TestCase; import org.jetbrains.jet.ConfigurationKind; +import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.checkers.AbstractJetDiagnosticsTest; import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment; import org.jetbrains.jet.jvm.compiler.NamespaceComparator; import org.jetbrains.jet.lang.descriptors.ModuleDescriptor; import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor; import org.jetbrains.jet.lang.psi.JetFile; +import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.test.generator.SimpleTestClassModel; import org.jetbrains.jet.test.generator.TestGenerator; @@ -37,18 +40,31 @@ * @author abreslav */ public abstract class AbstractLazyResolveDiagnosticsTest extends AbstractJetDiagnosticsTest { + + private static final File TEST_DATA_DIR = new File("compiler/testData/diagnostics/tests"); + @Override protected JetCoreEnvironment createEnvironment() { - return createEnvironmentWithMockJdk(ConfigurationKind.ALL); + return createEnvironmentWithMockJdk(ConfigurationKind.JDK_AND_ANNOTATIONS); } @Override - protected void analyzeAndCheck(String expectedText, List<TestFile> files) { + protected void analyzeAndCheck(File testDataFile, String expectedText, List<TestFile> files) { List<JetFile> jetFiles = getJetFiles(files); ModuleDescriptor lazyModule = LazyResolveTestUtil.resolveLazily(jetFiles, getEnvironment()); ModuleDescriptor eagerModule = LazyResolveTestUtil.resolveEagerly(jetFiles, getEnvironment()); - NamespaceComparator.assertNamespacesEqual(eagerModule.getRootNamespace(), lazyModule.getRootNamespace(), false, Predicates.<NamespaceDescriptor>alwaysTrue()); + String path = JetTestUtils.getFilePath(new File(FileUtil.getRelativePath(TEST_DATA_DIR, testDataFile))); + String txtFileRelativePath = path.replaceAll("\\.kt$|\\.ktscript", ".txt"); + File txtFile = new File("compiler/testData/lazyResolve/diagnostics/" + txtFileRelativePath); + NamespaceComparator.compareNamespaces(eagerModule.getRootNamespace(), lazyModule.getRootNamespace(), false, + new Predicate<NamespaceDescriptor>() { + @Override + public boolean apply(NamespaceDescriptor descriptor) { + return !Name.identifier("jet").equals(descriptor.getName()); + } + }, + txtFile); } public static void main(String[] args) throws IOException { @@ -59,7 +75,7 @@ public static void main(String[] args) throws IOException { "LazyResolveDiagnosticsTestGenerated", thisClass, Arrays.asList( - new SimpleTestClassModel(new File("compiler/testData/diagnostics/tests"), true, "kt", "doTest"), + new SimpleTestClassModel(TEST_DATA_DIR, true, "kt", "doTest"), new SimpleTestClassModel(new File("compiler/testData/diagnostics/tests/script"), true, "ktscript", "doTest") ), thisClass
04f1e7a41874bb93434c91c80544eda24afbb215
hadoop
HADOOP-7001. Configuration changes can occur via- the Reconfigurable interface. (Patrick Kline via dhruba)--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1038480 13f79535-47bb-0310-9956-ffa450edef68-
a
https://github.com/apache/hadoop
diff --git a/CHANGES.txt b/CHANGES.txt index fb24c361eaac0..3ac3baf1d920b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -14,6 +14,9 @@ Trunk (unreleased changes) HADOOP-7042. Updates to test-patch.sh to include failed test names and improve other messaging. (nigel) + HADOOP-7001. Configuration changes can occur via the Reconfigurable + interface. (Patrick Kline via dhruba) + OPTIMIZATIONS BUG FIXES diff --git a/src/java/org/apache/hadoop/conf/Configuration.java b/src/java/org/apache/hadoop/conf/Configuration.java index ac242d6282769..7f265f3e6b480 100644 --- a/src/java/org/apache/hadoop/conf/Configuration.java +++ b/src/java/org/apache/hadoop/conf/Configuration.java @@ -587,12 +587,22 @@ public void set(String name, String value) { } } + /** + * Unset a previously set property. + */ + public synchronized void unset(String name) { + name = handleDeprecation(name); + + getOverlay().remove(name); + getProps().remove(name); + } + /** * Sets a property if it is currently unset. * @param name the property name * @param value the new value */ - public void setIfUnset(String name, String value) { + public synchronized void setIfUnset(String name, String value) { if (get(name) == null) { set(name, value); } diff --git a/src/java/org/apache/hadoop/conf/ReconfigurableBase.java b/src/java/org/apache/hadoop/conf/ReconfigurableBase.java new file mode 100644 index 0000000000000..b872e77225914 --- /dev/null +++ b/src/java/org/apache/hadoop/conf/ReconfigurableBase.java @@ -0,0 +1,114 @@ +/** + * 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.apache.hadoop.conf; + +import org.apache.commons.logging.*; + +import java.util.Collection; + +/** + * Utility base class for implementing the Reconfigurable interface. + * + * Subclasses should override reconfigurePropertyImpl to change individual + * properties and getReconfigurableProperties to get all properties that + * can be changed at run time. + */ +public abstract class ReconfigurableBase + extends Configured implements Reconfigurable { + + private static final Log LOG = + LogFactory.getLog(ReconfigurableBase.class); + + /** + * Construct a ReconfigurableBase. + */ + public ReconfigurableBase() { + super(new Configuration()); + } + + /** + * Construct a ReconfigurableBase with the {@link Configuration} + * conf. + */ + public ReconfigurableBase(Configuration conf) { + super((conf == null) ? new Configuration() : conf); + } + + /** + * {@inheritDoc} + * + * This method makes the change to this objects {@link Configuration} + * and calls reconfigurePropertyImpl to update internal data structures. + * This method cannot be overridden, subclasses should instead override + * reconfigureProperty. + */ + @Override + public final String reconfigureProperty(String property, String newVal) + throws ReconfigurationException { + if (isPropertyReconfigurable(property)) { + LOG.info("changing property " + property + " to " + newVal); + String oldVal; + synchronized(getConf()) { + oldVal = getConf().get(property); + reconfigurePropertyImpl(property, newVal); + if (newVal != null) { + getConf().set(property, newVal); + } else { + getConf().unset(property); + } + } + return oldVal; + } else { + throw new ReconfigurationException(property, newVal, + getConf().get(property)); + } + } + + /** + * {@inheritDoc} + * + * Subclasses must override this. + */ + @Override + public abstract Collection<String> getReconfigurableProperties(); + + + /** + * {@inheritDoc} + * + * Subclasses may wish to override this with a more efficient implementation. + */ + @Override + public boolean isPropertyReconfigurable(String property) { + return getReconfigurableProperties().contains(property); + } + + /** + * Change a configuration property. + * + * Subclasses must override this. This method applies the change to + * all internal data structures derived from the configuration property + * that is being changed. If this object owns other Reconfigurable objects + * reconfigureProperty should be called recursively to make sure that + * to make sure that the configuration of these objects is updated. + */ + protected abstract void reconfigurePropertyImpl(String property, String newVal) + throws ReconfigurationException; + +} diff --git a/src/java/org/apache/hadoop/conf/ReconfigurationException.java b/src/java/org/apache/hadoop/conf/ReconfigurationException.java new file mode 100644 index 0000000000000..0935bf025fd30 --- /dev/null +++ b/src/java/org/apache/hadoop/conf/ReconfigurationException.java @@ -0,0 +1,104 @@ +/** + * 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.apache.hadoop.conf; + + +/** + * Exception indicating that configuration property cannot be changed + * at run time. + */ +public class ReconfigurationException extends Exception { + + private static final long serialVersionUID = 1L; + + private String property; + private String newVal; + private String oldVal; + + /** + * Construct the exception message. + */ + private static String constructMessage(String property, + String newVal, String oldVal) { + String message = "Could not change property " + property; + if (oldVal != null) { + message += " from \'" + oldVal; + } + if (newVal != null) { + message += "\' to \'" + newVal + "\'"; + } + return message; + } + + + /** + * Create a new instance of {@link ReconfigurationException}. + */ + public ReconfigurationException() { + super("Could not change configuration."); + this.property = null; + this.newVal = null; + this.oldVal = null; + } + + /** + * Create a new instance of {@link ReconfigurationException}. + */ + public ReconfigurationException(String property, + String newVal, String oldVal, + Throwable cause) { + super(constructMessage(property, newVal, oldVal), cause); + this.property = property; + this.newVal = newVal; + this.oldVal = oldVal; + } + + /** + * Create a new instance of {@link ReconfigurationException}. + */ + public ReconfigurationException(String property, + String newVal, String oldVal) { + super(constructMessage(property, newVal, oldVal)); + this.property = property; + this.newVal = newVal; + this.oldVal = oldVal; + } + + /** + * Get property that cannot be changed. + */ + public String getProperty() { + return property; + } + + /** + * Get value to which property was supposed to be changed. + */ + public String getNewValue() { + return newVal; + } + + /** + * Get old value of property that cannot be changed. + */ + public String getOldValue() { + return oldVal; + } + +} diff --git a/src/java/org/apache/hadoop/conf/ReconfigurationServlet.java b/src/java/org/apache/hadoop/conf/ReconfigurationServlet.java new file mode 100644 index 0000000000000..041b263edd92d --- /dev/null +++ b/src/java/org/apache/hadoop/conf/ReconfigurationServlet.java @@ -0,0 +1,248 @@ +/** + * 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.apache.hadoop.conf; + +import org.apache.commons.logging.*; + +import org.apache.commons.lang.StringEscapeUtils; + +import java.util.Collection; +import java.util.Map; +import java.util.Enumeration; +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.hadoop.util.StringUtils; + +/** + * A servlet for changing a node's configuration. + * + * Reloads the configuration file, verifies whether changes are + * possible and asks the admin to approve the change. + * + */ +public class ReconfigurationServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + private static final Log LOG = + LogFactory.getLog(ReconfigurationServlet.class); + + // the prefix used to fing the attribute holding the reconfigurable + // for a given request + // + // we get the attribute prefix + servlet path + public static final String CONF_SERVLET_RECONFIGURABLE_PREFIX = + "conf.servlet.reconfigurable."; + + /** + * {@inheritDoc} + */ + @Override + public void init() throws ServletException { + super.init(); + } + + private Reconfigurable getReconfigurable(HttpServletRequest req) { + LOG.info("servlet path: " + req.getServletPath()); + LOG.info("getting attribute: " + CONF_SERVLET_RECONFIGURABLE_PREFIX + + req.getServletPath()); + return (Reconfigurable) + this.getServletContext().getAttribute(CONF_SERVLET_RECONFIGURABLE_PREFIX + + req.getServletPath()); + } + + private void printHeader(PrintWriter out, String nodeName) { + out.print("<html><head>"); + out.printf("<title>%s Reconfiguration Utility</title>\n", + StringEscapeUtils.escapeHtml(nodeName)); + out.print("</head><body>\n"); + out.printf("<h1>%s Reconfiguration Utility</h1>\n", + StringEscapeUtils.escapeHtml(nodeName)); + } + + private void printFooter(PrintWriter out) { + out.print("</body></html>\n"); + } + + /** + * Print configuration options that can be changed. + */ + private void printConf(PrintWriter out, Reconfigurable reconf) { + Configuration oldConf = reconf.getConf(); + Configuration newConf = new Configuration(); + + Collection<ReconfigurationUtil.PropertyChange> changes = + ReconfigurationUtil.getChangedProperties(newConf, + oldConf); + + boolean changeOK = true; + + out.println("<form action=\"\" method=\"post\">"); + out.println("<table border=\"1\">"); + out.println("<tr><th>Property</th><th>Old value</th>"); + out.println("<th>New value </th><th></th></tr>"); + for (ReconfigurationUtil.PropertyChange c: changes) { + out.print("<tr><td>"); + if (!reconf.isPropertyReconfigurable(c.prop)) { + out.print("<font color=\"red\">" + + StringEscapeUtils.escapeHtml(c.prop) + "</font>"); + changeOK = false; + } else { + out.print(StringEscapeUtils.escapeHtml(c.prop)); + out.print("<input type=\"hidden\" name=\"" + + StringEscapeUtils.escapeHtml(c.prop) + "\" value=\"" + + StringEscapeUtils.escapeHtml(c.newVal) + "\"/>"); + } + out.print("</td><td>" + + (c.oldVal == null ? "<it>default</it>" : + StringEscapeUtils.escapeHtml(c.oldVal)) + + "</td><td>" + + (c.newVal == null ? "<it>default</it>" : + StringEscapeUtils.escapeHtml(c.newVal)) + + "</td>"); + out.print("</tr>\n"); + } + out.println("</table>"); + if (!changeOK) { + out.println("<p><font color=\"red\">WARNING: properties marked red" + + " will not be changed until the next restart.</font></p>"); + } + out.println("<input type=\"submit\" value=\"Apply\" />"); + out.println("</form>"); + } + + @SuppressWarnings("unchecked") + private Enumeration<String> getParams(HttpServletRequest req) { + return (Enumeration<String>) req.getParameterNames(); + } + + /** + * Apply configuratio changes after admin has approved them. + */ + private void applyChanges(PrintWriter out, Reconfigurable reconf, + HttpServletRequest req) + throws IOException, ReconfigurationException { + Configuration oldConf = reconf.getConf(); + Configuration newConf = new Configuration(); + + Enumeration<String> params = getParams(req); + + synchronized(oldConf) { + while (params.hasMoreElements()) { + String rawParam = params.nextElement(); + String param = StringEscapeUtils.unescapeHtml(rawParam); + String value = + StringEscapeUtils.unescapeHtml(req.getParameter(rawParam)); + if (value != null) { + if (value.equals(newConf.getRaw(param)) || value.equals("default") || + value.equals("null") || value.equals("")) { + if ((value.equals("default") || value.equals("null") || + value.equals("")) && + oldConf.getRaw(param) != null) { + out.println("<p>Changed \"" + + StringEscapeUtils.escapeHtml(param) + "\" from \"" + + StringEscapeUtils.escapeHtml(oldConf.getRaw(param)) + + "\" to default</p>"); + reconf.reconfigureProperty(param, null); + } else if (!value.equals("default") && !value.equals("null") && + !value.equals("") && + (oldConf.getRaw(param) == null || + !oldConf.getRaw(param).equals(value))) { + // change from default or value to different value + if (oldConf.getRaw(param) == null) { + out.println("<p>Changed \"" + + StringEscapeUtils.escapeHtml(param) + + "\" from default to \"" + + StringEscapeUtils.escapeHtml(value) + "\"</p>"); + } else { + out.println("<p>Changed \"" + + StringEscapeUtils.escapeHtml(param) + "\" from \"" + + StringEscapeUtils.escapeHtml(oldConf. + getRaw(param)) + + "\" to \"" + + StringEscapeUtils.escapeHtml(value) + "\"</p>"); + } + reconf.reconfigureProperty(param, value); + } else { + LOG.info("property " + param + " unchanged"); + } + } else { + // parameter value != newConf value + out.println("<p>\"" + StringEscapeUtils.escapeHtml(param) + + "\" not changed because value has changed from \"" + + StringEscapeUtils.escapeHtml(value) + "\" to \"" + + StringEscapeUtils.escapeHtml(newConf.getRaw(param)) + + "\" since approval</p>"); + } + } + } + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException { + LOG.info("GET"); + PrintWriter out = resp.getWriter(); + + Reconfigurable reconf = getReconfigurable(req); + String nodeName = reconf.getClass().getCanonicalName(); + + printHeader(out, nodeName); + printConf(out, reconf); + printFooter(out); + } + + /** + * {@inheritDoc} + */ + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException { + LOG.info("POST"); + PrintWriter out = resp.getWriter(); + + Reconfigurable reconf = getReconfigurable(req); + String nodeName = reconf.getClass().getCanonicalName(); + + printHeader(out, nodeName); + + try { + applyChanges(out, reconf, req); + } catch (ReconfigurationException e) { + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, + StringUtils.stringifyException(e)); + return; + } + + out.println("<p><a href=\"" + req.getServletPath() + "\">back</a></p>"); + printFooter(out); + } + +} \ No newline at end of file diff --git a/src/java/org/apache/hadoop/conf/ReconfigurationUtil.java b/src/java/org/apache/hadoop/conf/ReconfigurationUtil.java new file mode 100644 index 0000000000000..ca685f4058491 --- /dev/null +++ b/src/java/org/apache/hadoop/conf/ReconfigurationUtil.java @@ -0,0 +1,66 @@ +/** + * 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.apache.hadoop.conf; + +import java.util.Map; +import java.util.Collection; +import java.util.HashMap; + +public class ReconfigurationUtil { + + public static class PropertyChange { + public String prop; + public String oldVal; + public String newVal; + + public PropertyChange(String prop, String newVal, String oldVal) { + this.prop = prop; + this.newVal = newVal; + this.oldVal = oldVal; + } + } + + public static Collection<PropertyChange> + getChangedProperties(Configuration newConf, Configuration oldConf) { + Map<String, PropertyChange> changes = new HashMap<String, PropertyChange>(); + + // iterate over old configuration + for (Map.Entry<String, String> oldEntry: oldConf) { + String prop = oldEntry.getKey(); + String oldVal = oldEntry.getValue(); + String newVal = newConf.getRaw(prop); + + if (newVal == null || !newVal.equals(oldVal)) { + changes.put(prop, new PropertyChange(prop, newVal, oldVal)); + } + } + + // now iterate over new configuration + // (to look for properties not present in old conf) + for (Map.Entry<String, String> newEntry: newConf) { + String prop = newEntry.getKey(); + String newVal = newEntry.getValue(); + if (oldConf.get(prop) == null) { + changes.put(prop, new PropertyChange(prop, newVal, null)); + } + } + + return changes.values(); + } +} \ No newline at end of file diff --git a/src/test/core/org/apache/hadoop/conf/TestReconfiguration.java b/src/test/core/org/apache/hadoop/conf/TestReconfiguration.java new file mode 100644 index 0000000000000..d3e93a5f793af --- /dev/null +++ b/src/test/core/org/apache/hadoop/conf/TestReconfiguration.java @@ -0,0 +1,293 @@ +/** + * 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.apache.hadoop.conf; + +import junit.framework.TestCase; + +import org.junit.Test; +import org.junit.Before; + +import java.util.Collection; +import java.util.Arrays; + +public class TestReconfiguration extends TestCase { + private Configuration conf1; + private Configuration conf2; + + private static final String PROP1 = "test.prop.one"; + private static final String PROP2 = "test.prop.two"; + private static final String PROP3 = "test.prop.three"; + private static final String PROP4 = "test.prop.four"; + private static final String PROP5 = "test.prop.five"; + + private static final String VAL1 = "val1"; + private static final String VAL2 = "val2"; + + @Before + public void setUp () { + conf1 = new Configuration(); + conf2 = new Configuration(); + + // set some test properties + conf1.set(PROP1, VAL1); + conf1.set(PROP2, VAL1); + conf1.set(PROP3, VAL1); + + conf2.set(PROP1, VAL1); // same as conf1 + conf2.set(PROP2, VAL2); // different value as conf1 + // PROP3 not set in conf2 + conf2.set(PROP4, VAL1); // not set in conf1 + + } + + /** + * Test ReconfigurationUtil.getChangedProperties. + */ + @Test + public void testGetChangedProperties() { + Collection<ReconfigurationUtil.PropertyChange> changes = + ReconfigurationUtil.getChangedProperties(conf2, conf1); + + assertTrue(changes.size() == 3); + + boolean changeFound = false; + boolean unsetFound = false; + boolean setFound = false; + + for (ReconfigurationUtil.PropertyChange c: changes) { + if (c.prop.equals(PROP2) && c.oldVal != null && c.oldVal.equals(VAL1) && + c.newVal != null && c.newVal.equals(VAL2)) { + changeFound = true; + } else if (c.prop.equals(PROP3) && c.oldVal != null && c.oldVal.equals(VAL1) && + c.newVal == null) { + unsetFound = true; + } else if (c.prop.equals(PROP4) && c.oldVal == null && + c.newVal != null && c.newVal.equals(VAL1)) { + setFound = true; + } + } + + assertTrue(changeFound && unsetFound && setFound); + } + + /** + * a simple reconfigurable class + */ + public static class ReconfigurableDummy extends ReconfigurableBase + implements Runnable { + public volatile boolean running = true; + + public ReconfigurableDummy(Configuration conf) { + super(conf); + } + + /** + * {@inheritDoc} + */ + @Override + public Collection<String> getReconfigurableProperties() { + return Arrays.asList(PROP1, PROP2, PROP4); + } + + /** + * {@inheritDoc} + */ + @Override + public synchronized void reconfigurePropertyImpl(String property, + String newVal) { + // do nothing + } + + /** + * Run until PROP1 is no longer VAL1. + */ + @Override + public void run() { + while (running && getConf().get(PROP1).equals(VAL1)) { + try { + Thread.sleep(1); + } catch (InterruptedException ignore) { + // do nothing + } + } + } + + } + + /** + * Test reconfiguring a Reconfigurable. + */ + @Test + public void testReconfigure() { + ReconfigurableDummy dummy = new ReconfigurableDummy(conf1); + + assertTrue(dummy.getConf().get(PROP1).equals(VAL1)); + assertTrue(dummy.getConf().get(PROP2).equals(VAL1)); + assertTrue(dummy.getConf().get(PROP3).equals(VAL1)); + assertTrue(dummy.getConf().get(PROP4) == null); + assertTrue(dummy.getConf().get(PROP5) == null); + + assertTrue(dummy.isPropertyReconfigurable(PROP1)); + assertTrue(dummy.isPropertyReconfigurable(PROP2)); + assertFalse(dummy.isPropertyReconfigurable(PROP3)); + assertTrue(dummy.isPropertyReconfigurable(PROP4)); + assertFalse(dummy.isPropertyReconfigurable(PROP5)); + + // change something to the same value as before + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP1, VAL1); + assertTrue(dummy.getConf().get(PROP1).equals(VAL1)); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertFalse(exceptionCaught); + } + + // change something to null + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP1, null); + assertTrue(dummy.getConf().get(PROP1) == null); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertFalse(exceptionCaught); + } + + // change something to a different value than before + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP1, VAL2); + assertTrue(dummy.getConf().get(PROP1).equals(VAL2)); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertFalse(exceptionCaught); + } + + // set unset property to null + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP4, null); + assertTrue(dummy.getConf().get(PROP4) == null); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertFalse(exceptionCaught); + } + + // set unset property + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP4, VAL1); + assertTrue(dummy.getConf().get(PROP4).equals(VAL1)); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertFalse(exceptionCaught); + } + + // try to set unset property to null (not reconfigurable) + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP5, null); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertTrue(exceptionCaught); + } + + // try to set unset property to value (not reconfigurable) + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP5, VAL1); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertTrue(exceptionCaught); + } + + // try to change property to value (not reconfigurable) + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP3, VAL2); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertTrue(exceptionCaught); + } + + // try to change property to null (not reconfigurable) + { + boolean exceptionCaught = false; + try { + dummy.reconfigureProperty(PROP3, null); + } catch (ReconfigurationException e) { + exceptionCaught = true; + } + assertTrue(exceptionCaught); + } + } + + /** + * Test whether configuration changes are visible in another thread. + */ + @Test + public void testThread() throws ReconfigurationException { + ReconfigurableDummy dummy = new ReconfigurableDummy(conf1); + assertTrue(dummy.getConf().get(PROP1).equals(VAL1)); + Thread dummyThread = new Thread(dummy); + dummyThread.start(); + try { + Thread.sleep(500); + } catch (InterruptedException ignore) { + // do nothing + } + dummy.reconfigureProperty(PROP1, VAL2); + + long endWait = System.currentTimeMillis() + 2000; + while (dummyThread.isAlive() && System.currentTimeMillis() < endWait) { + try { + Thread.sleep(50); + } catch (InterruptedException ignore) { + // do nothing + } + } + + assertFalse(dummyThread.isAlive()); + dummy.running = false; + try { + dummyThread.join(); + } catch (InterruptedException ignore) { + // do nothing + } + assertTrue(dummy.getConf().get(PROP1).equals(VAL2)); + + } + +} \ No newline at end of file
5fe802ea0a094289b6989748da75fb2942058aba
hadoop
HADOOP-6987. Use JUnit Rule to optionally fail test- cases that run more than 10 seconds.--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1005977 13f79535-47bb-0310-9956-ffa450edef68-
p
https://github.com/apache/hadoop
diff --git a/CHANGES.txt b/CHANGES.txt index 4a6782840ba38..ef95bd7654b88 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -136,6 +136,9 @@ Trunk (unreleased changes) HADOOP-6856. Simplify constructors for SequenceFile, and MapFile. (omalley) + HADOOP-6987. Use JUnit Rule to optionally fail test cases that run more + than 10 seconds (jghoman) + OPTIMIZATIONS HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..). diff --git a/src/test/core/org/apache/hadoop/test/UnitTestcaseTimeLimit.java b/src/test/core/org/apache/hadoop/test/UnitTestcaseTimeLimit.java new file mode 100644 index 0000000000000..5581c7d75da85 --- /dev/null +++ b/src/test/core/org/apache/hadoop/test/UnitTestcaseTimeLimit.java @@ -0,0 +1,34 @@ +/** + * 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.apache.hadoop.test; + +import org.junit.Rule; +import org.junit.rules.MethodRule; +import org.junit.rules.Timeout; + +/** + * Class for test units to extend in order that their individual tests will + * be timed out and fail automatically should they run more than 10 seconds. + * This provides an automatic regression check for tests that begin running + * longer than expected. + */ +public class UnitTestcaseTimeLimit { + public final int timeOutSecs = 10; + + @Rule public MethodRule globalTimeout = new Timeout(timeOutSecs * 1000); +} diff --git a/src/test/core/org/apache/hadoop/util/TestStringUtils.java b/src/test/core/org/apache/hadoop/util/TestStringUtils.java index 0c5479d12c20f..7135a463de9f2 100644 --- a/src/test/core/org/apache/hadoop/util/TestStringUtils.java +++ b/src/test/core/org/apache/hadoop/util/TestStringUtils.java @@ -18,13 +18,17 @@ package org.apache.hadoop.util; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import java.util.ArrayList; import java.util.List; -import junit.framework.TestCase; -import static org.junit.Assert.assertArrayEquals; +import org.apache.hadoop.test.UnitTestcaseTimeLimit; +import org.junit.Test; -public class TestStringUtils extends TestCase { +public class TestStringUtils extends UnitTestcaseTimeLimit { final private static String NULL_STR = null; final private static String EMPTY_STR = ""; final private static String STR_WO_SPECIAL_CHARS = "AB"; @@ -36,6 +40,7 @@ public class TestStringUtils extends TestCase { final private static String ESCAPED_STR_WITH_BOTH2 = "\\,A\\\\\\,\\,B\\\\\\\\\\,"; + @Test public void testEscapeString() throws Exception { assertEquals(NULL_STR, StringUtils.escapeString(NULL_STR)); assertEquals(EMPTY_STR, StringUtils.escapeString(EMPTY_STR)); @@ -49,6 +54,7 @@ public void testEscapeString() throws Exception { StringUtils.escapeString(STR_WITH_BOTH2)); } + @Test public void testSplit() throws Exception { assertEquals(NULL_STR, StringUtils.split(NULL_STR)); String[] splits = StringUtils.split(EMPTY_STR); @@ -78,6 +84,7 @@ public void testSplit() throws Exception { assertEquals(ESCAPED_STR_WITH_BOTH2, splits[0]); } + @Test public void testSimpleSplit() throws Exception { final String[] TO_TEST = { "a/b/c", @@ -93,6 +100,7 @@ public void testSimpleSplit() throws Exception { } } + @Test public void testUnescapeString() throws Exception { assertEquals(NULL_STR, StringUtils.unEscapeString(NULL_STR)); assertEquals(EMPTY_STR, StringUtils.unEscapeString(EMPTY_STR)); @@ -124,6 +132,7 @@ public void testUnescapeString() throws Exception { StringUtils.unEscapeString(ESCAPED_STR_WITH_BOTH2)); } + @Test public void testTraditionalBinaryPrefix() throws Exception { String[] symbol = {"k", "m", "g", "t", "p", "e"}; long m = 1024; @@ -138,6 +147,7 @@ public void testTraditionalBinaryPrefix() throws Exception { assertEquals(956703965184L, StringUtils.TraditionalBinaryPrefix.string2long("891g")); } + @Test public void testJoin() { List<String> s = new ArrayList<String>(); s.add("a"); @@ -149,6 +159,7 @@ public void testJoin() { assertEquals("a:b:c", StringUtils.join(":", s.subList(0, 3))); } + @Test public void testGetTrimmedStrings() throws Exception { String compactDirList = "/spindle1/hdfs,/spindle2/hdfs,/spindle3/hdfs"; String spacedDirList = "/spindle1/hdfs, /spindle2/hdfs, /spindle3/hdfs"; @@ -169,6 +180,7 @@ public void testGetTrimmedStrings() throws Exception { assertArrayEquals(emptyArray, StringUtils.getTrimmedStrings(emptyList2)); } + @Test public void testCamelize() { // common use cases assertEquals("Map", StringUtils.camelize("MAP"));
7b301d160b20e37c9bedcfed7c9d12dd7e603a6f
restlet-framework-java
Compute logged duration only if needed.--
p
https://github.com/restlet/restlet-framework-java
diff --git a/modules/com.noelios.restlet/src/com/noelios/restlet/LogFilter.java b/modules/com.noelios.restlet/src/com/noelios/restlet/LogFilter.java index 5f935fa21b..1e97a9a1dd 100644 --- a/modules/com.noelios.restlet/src/com/noelios/restlet/LogFilter.java +++ b/modules/com.noelios.restlet/src/com/noelios/restlet/LogFilter.java @@ -49,9 +49,9 @@ * several threads at the same time and therefore must be thread-safe. You * should be especially careful when storing state in member variables. * - * @see <a + * @see <a * * href="http://www.restlet.org/documentation/1.1/tutorial#part07">Tutorial - * : Filters and call logging</a> + * * : Filters and call logging< /a> * @author Jerome Louvel */ public class LogFilter extends Filter { @@ -101,16 +101,17 @@ public LogFilter(Context context, LogService logService) { */ @Override protected void afterHandle(Request request, Response response) { - final long startTime = (Long) request.getAttributes().get( - "org.restlet.startTime"); - final int duration = (int) (System.currentTimeMillis() - startTime); - // Format the call into a log entry if (this.logTemplate != null) { this.logLogger.log(Level.INFO, format(request, response)); } else { - this.logLogger.log(Level.INFO, formatDefault(request, response, - duration)); + if (this.logLogger.isLoggable(Level.INFO)) { + final long startTime = (Long) request.getAttributes().get( + "org.restlet.startTime"); + final int duration = (int) (System.currentTimeMillis() - startTime); + this.logLogger.log(Level.INFO, formatDefault(request, response, + duration)); + } } }
6b24921bd49cc1179d9e9dc36d68e5aeeacb6550
elasticsearch
[TEST] Re-add rebalance disable setting in- RecoveryFromGatewayTests--
p
https://github.com/elastic/elasticsearch
diff --git a/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayTests.java b/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayTests.java index d05f686b26100..b1ad29d7db2ec 100644 --- a/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayTests.java +++ b/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayTests.java @@ -354,7 +354,9 @@ public void testReusePeerRecovery() throws Exception { // prevent any rebalance actions during the peer recovery // if we run into a relocation the reuse count will be 0 and this fails the test. We are testing here if // we reuse the files on disk after full restarts for replicas. - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put(indexSettings()))); + assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + .put(indexSettings()) + .put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, EnableAllocationDecider.Rebalance.NONE))); ensureGreen(); logger.info("--> indexing docs"); for (int i = 0; i < 1000; i++) {
c23c5d2494aafc4416a98e6768a1f3a3022cd011
elasticsearch
Added support for acknowledgement from other- nodes in open/close index api--The open/close index api now waits for an acknowledgement from all the other nodes before returning its response, till the timeout (configurable, default 10 secs) expires. The returned acknowledged flag reflects whether the cluster state change was acknowledged by all the nodes or the timeout expired before.--Closes -3400-
p
https://github.com/elastic/elasticsearch
diff --git a/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java index ab524de7a37c8..aea253427b0aa 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java @@ -45,7 +45,7 @@ public class CloseIndexRequest extends MasterNodeOperationRequest<CloseIndexRequ } /** - * Constructs a new delete index request for the specified index. + * Constructs a new close index request for the specified index. */ public CloseIndexRequest(String... indices) { this.indices = indices; @@ -79,7 +79,7 @@ public CloseIndexRequest indices(String... indices) { } /** - * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults + * Timeout to wait for the index closure to be acknowledged by current cluster nodes. Defaults * to <tt>10s</tt>. */ TimeValue timeout() { @@ -87,7 +87,7 @@ TimeValue timeout() { } /** - * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults + * Timeout to wait for the index closure to be acknowledged by current cluster nodes. Defaults * to <tt>10s</tt>. */ public CloseIndexRequest timeout(TimeValue timeout) { @@ -96,7 +96,7 @@ public CloseIndexRequest timeout(TimeValue timeout) { } /** - * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults + * Timeout to wait for the index closure to be acknowledged by current cluster nodes. Defaults * to <tt>10s</tt>. */ public CloseIndexRequest timeout(String timeout) { diff --git a/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java index ee79644359c38..dd9151b124f81 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java @@ -45,7 +45,7 @@ public class OpenIndexRequest extends MasterNodeOperationRequest<OpenIndexReques } /** - * Constructs a new delete index request for the specified index. + * Constructs a new open index request for the specified index. */ public OpenIndexRequest(String... indices) { this.indices = indices; @@ -79,7 +79,7 @@ public OpenIndexRequest indices(String... indices) { } /** - * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults + * Timeout to wait for the index opening to be acknowledged by current cluster nodes. Defaults * to <tt>10s</tt>. */ TimeValue timeout() { @@ -87,7 +87,7 @@ TimeValue timeout() { } /** - * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults + * Timeout to wait for the index opening to be acknowledged by current cluster nodes. Defaults * to <tt>10s</tt>. */ public OpenIndexRequest timeout(TimeValue timeout) { @@ -96,7 +96,7 @@ public OpenIndexRequest timeout(TimeValue timeout) { } /** - * Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults + * Timeout to wait for the index opening to be acknowledged by current cluster nodes. Defaults * to <tt>10s</tt>. */ public OpenIndexRequest timeout(String timeout) { diff --git a/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java b/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java index abf7a6af23f11..305b539e25b21 100644 --- a/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java +++ b/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java @@ -20,12 +20,14 @@ package org.elasticsearch.cluster; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.node.DiscoveryNodes; import java.util.List; +import java.util.Map; /** * @@ -161,4 +163,22 @@ public boolean nodesAdded() { public boolean nodesChanged() { return nodesRemoved() || nodesAdded(); } -} + + public boolean indicesStateChanged() { + if (metaDataChanged()) { + ImmutableMap<String,IndexMetaData> indices = state.metaData().indices(); + ImmutableMap<String,IndexMetaData> previousIndices = previousState.metaData().indices(); + + for (Map.Entry<String, IndexMetaData> entry : indices.entrySet()) { + IndexMetaData indexMetaData = entry.getValue(); + IndexMetaData previousIndexMetaData = previousIndices.get(entry.getKey()); + if (previousIndexMetaData != null + && indexMetaData.state() != previousIndexMetaData.state()) { + return true; + } + } + } + + return false; + } +} \ No newline at end of file diff --git a/src/main/java/org/elasticsearch/cluster/ClusterModule.java b/src/main/java/org/elasticsearch/cluster/ClusterModule.java index 2adf89e519692..5df5395f96cc8 100644 --- a/src/main/java/org/elasticsearch/cluster/ClusterModule.java +++ b/src/main/java/org/elasticsearch/cluster/ClusterModule.java @@ -77,5 +77,6 @@ protected void configure() { bind(NodeMappingRefreshAction.class).asEagerSingleton(); bind(MappingUpdatedAction.class).asEagerSingleton(); bind(NodeAliasesUpdatedAction.class).asEagerSingleton(); + bind(NodeIndicesStateUpdatedAction.class).asEagerSingleton(); } } \ No newline at end of file diff --git a/src/main/java/org/elasticsearch/cluster/action/index/NodeIndicesStateUpdatedAction.java b/src/main/java/org/elasticsearch/cluster/action/index/NodeIndicesStateUpdatedAction.java new file mode 100644 index 0000000000000..ad9394fae53fe --- /dev/null +++ b/src/main/java/org/elasticsearch/cluster/action/index/NodeIndicesStateUpdatedAction.java @@ -0,0 +1,154 @@ +/* + * Licensed to ElasticSearch and Shay Banon under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. ElasticSearch 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.elasticsearch.cluster.action.index; + +import org.elasticsearch.ElasticSearchException; +import org.elasticsearch.cluster.ClusterService; +import org.elasticsearch.cluster.node.DiscoveryNodes; +import org.elasticsearch.common.component.AbstractComponent; +import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.threadpool.ThreadPool; +import org.elasticsearch.transport.*; + +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +public class NodeIndicesStateUpdatedAction extends AbstractComponent { + + private final ThreadPool threadPool; + + private final TransportService transportService; + + private final ClusterService clusterService; + + private final List<Listener> listeners = new CopyOnWriteArrayList<Listener>(); + + @Inject + public NodeIndicesStateUpdatedAction(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterService clusterService) { + super(settings); + this.threadPool = threadPool; + this.transportService = transportService; + this.clusterService = clusterService; + transportService.registerHandler(NodeIndexStateUpdatedTransportHandler.ACTION, new NodeIndexStateUpdatedTransportHandler()); + } + + public void add(final Listener listener, TimeValue timeout) { + listeners.add(listener); + threadPool.schedule(timeout, ThreadPool.Names.GENERIC, new Runnable() { + @Override + public void run() { + boolean removed = listeners.remove(listener); + if (removed) { + listener.onTimeout(); + } + } + }); + } + + public void remove(Listener listener) { + listeners.remove(listener); + } + + public void nodeIndexStateUpdated(final NodeIndexStateUpdatedResponse response) throws ElasticSearchException { + DiscoveryNodes nodes = clusterService.state().nodes(); + if (nodes.localNodeMaster()) { + threadPool.generic().execute(new Runnable() { + @Override + public void run() { + innerNodeIndexStateUpdated(response); + } + }); + } else { + transportService.sendRequest(clusterService.state().nodes().masterNode(), + NodeIndexStateUpdatedTransportHandler.ACTION, response, EmptyTransportResponseHandler.INSTANCE_SAME); + } + } + + private void innerNodeIndexStateUpdated(NodeIndexStateUpdatedResponse response) { + for (Listener listener : listeners) { + listener.onIndexStateUpdated(response); + } + } + + private class NodeIndexStateUpdatedTransportHandler extends BaseTransportRequestHandler<NodeIndexStateUpdatedResponse> { + + static final String ACTION = "cluster/nodeIndexStateUpdated"; + + @Override + public NodeIndexStateUpdatedResponse newInstance() { + return new NodeIndexStateUpdatedResponse(); + } + + @Override + public void messageReceived(NodeIndexStateUpdatedResponse response, TransportChannel channel) throws Exception { + innerNodeIndexStateUpdated(response); + channel.sendResponse(TransportResponse.Empty.INSTANCE); + } + + @Override + public String executor() { + return ThreadPool.Names.SAME; + } + } + + public static interface Listener { + void onIndexStateUpdated(NodeIndexStateUpdatedResponse response); + void onTimeout(); + } + + public static class NodeIndexStateUpdatedResponse extends TransportRequest { + private String nodeId; + private long version; + + NodeIndexStateUpdatedResponse() { + } + + public NodeIndexStateUpdatedResponse(String nodeId, long version) { + this.nodeId = nodeId; + this.version = version; + } + + public String nodeId() { + return nodeId; + } + + public long version() { + return version; + } + + @Override + public void writeTo(StreamOutput out) throws IOException { + super.writeTo(out); + out.writeString(nodeId); + out.writeLong(version); + } + + @Override + public void readFrom(StreamInput in) throws IOException { + super.readFrom(in); + nodeId = in.readString(); + version = in.readLong(); + } + } +} diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataStateIndexService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataStateIndexService.java index 9c9272ec84237..4110b8890efc9 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataStateIndexService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataStateIndexService.java @@ -24,6 +24,7 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.TimeoutClusterStateUpdateTask; +import org.elasticsearch.cluster.action.index.NodeIndicesStateUpdatedAction; import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.block.ClusterBlocks; @@ -45,6 +46,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; /** * @@ -57,11 +60,14 @@ public class MetaDataStateIndexService extends AbstractComponent { private final AllocationService allocationService; + private final NodeIndicesStateUpdatedAction indicesStateUpdatedAction; + @Inject - public MetaDataStateIndexService(Settings settings, ClusterService clusterService, AllocationService allocationService) { + public MetaDataStateIndexService(Settings settings, ClusterService clusterService, AllocationService allocationService, NodeIndicesStateUpdatedAction indicesStateUpdatedAction) { super(settings); this.clusterService = clusterService; this.allocationService = allocationService; + this.indicesStateUpdatedAction = indicesStateUpdatedAction; } public void closeIndex(final Request request, final Listener listener) { @@ -127,12 +133,19 @@ public ClusterState execute(ClusterState currentState) { RoutingAllocation.Result routingResult = allocationService.reroute(ClusterState.builder().state(updatedState).routingTable(rtBuilder).build()); - return ClusterState.builder().state(updatedState).routingResult(routingResult).build(); + ClusterState newClusterState = ClusterState.builder().state(updatedState).routingResult(routingResult).build(); + + waitForOtherNodes(newClusterState, listener, request.timeout); + + return newClusterState; } @Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { - listener.onResponse(new Response(true)); + if (oldState == newState) { + // we didn't do anything, callback + listener.onResponse(new Response(true)); + } } }); } @@ -192,16 +205,32 @@ public ClusterState execute(ClusterState currentState) { RoutingAllocation.Result routingResult = allocationService.reroute(ClusterState.builder().state(updatedState).routingTable(rtBuilder).build()); - return ClusterState.builder().state(updatedState).routingResult(routingResult).build(); + ClusterState newClusterState = ClusterState.builder().state(updatedState).routingResult(routingResult).build(); + + waitForOtherNodes(newClusterState, listener, request.timeout); + + return newClusterState; + } @Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { - listener.onResponse(new Response(true)); + if (oldState == newState) { + // we didn't do anything, callback + listener.onResponse(new Response(true)); + } } }); } + private void waitForOtherNodes(ClusterState updatedState, Listener listener, TimeValue timeout) { + // wait for responses from other nodes if needed + int responseCount = updatedState.nodes().size(); + long version = updatedState.version() + 1; + logger.trace("waiting for [{}] notifications with version [{}]", responseCount, version); + indicesStateUpdatedAction.add(new CountDownListener(responseCount, listener, version), timeout); + } + public static interface Listener { void onResponse(Response response); @@ -242,4 +271,39 @@ public boolean acknowledged() { return acknowledged; } } + + private class CountDownListener implements NodeIndicesStateUpdatedAction.Listener { + + private final AtomicBoolean notified = new AtomicBoolean(); + private final AtomicInteger countDown; + private final Listener listener; + private final long version; + + public CountDownListener(int countDown, Listener listener, long version) { + this.countDown = new AtomicInteger(countDown); + this.listener = listener; + this.version = version; + } + + @Override + public void onIndexStateUpdated(NodeIndicesStateUpdatedAction.NodeIndexStateUpdatedResponse response) { + if (version <= response.version()) { + logger.trace("Received NodeIndexStateUpdatedResponse with version [{}] from [{}]", response.version(), response.nodeId()); + if (countDown.decrementAndGet() == 0) { + indicesStateUpdatedAction.remove(this); + if (notified.compareAndSet(false, true)) { + listener.onResponse(new Response(true)); + } + } + } + } + + @Override + public void onTimeout() { + indicesStateUpdatedAction.remove(this); + if (notified.compareAndSet(false, true)) { + listener.onResponse(new Response(false)); + } + } + } } diff --git a/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java b/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java index 11dd3f0a33f63..82654cdf389f7 100644 --- a/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java +++ b/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java @@ -86,6 +86,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic private final NodeMappingCreatedAction nodeMappingCreatedAction; private final NodeMappingRefreshAction nodeMappingRefreshAction; private final NodeAliasesUpdatedAction nodeAliasesUpdatedAction; + private final NodeIndicesStateUpdatedAction nodeIndicesStateUpdatedAction; // a map of mappings type we have seen per index due to cluster state // we need this so we won't remove types automatically created as part of the indexing process @@ -101,7 +102,7 @@ public IndicesClusterStateService(Settings settings, IndicesService indicesServi ShardStateAction shardStateAction, NodeIndexCreatedAction nodeIndexCreatedAction, NodeIndexDeletedAction nodeIndexDeletedAction, NodeMappingCreatedAction nodeMappingCreatedAction, NodeMappingRefreshAction nodeMappingRefreshAction, - NodeAliasesUpdatedAction nodeAliasesUpdatedAction) { + NodeAliasesUpdatedAction nodeAliasesUpdatedAction, NodeIndicesStateUpdatedAction nodeIndicesStateUpdatedAction) { super(settings); this.indicesService = indicesService; this.clusterService = clusterService; @@ -113,6 +114,7 @@ public IndicesClusterStateService(Settings settings, IndicesService indicesServi this.nodeMappingCreatedAction = nodeMappingCreatedAction; this.nodeMappingRefreshAction = nodeMappingRefreshAction; this.nodeAliasesUpdatedAction = nodeAliasesUpdatedAction; + this.nodeIndicesStateUpdatedAction = nodeIndicesStateUpdatedAction; } @Override @@ -167,6 +169,7 @@ public void clusterChanged(final ClusterChangedEvent event) { applyCleanedIndices(event); applySettings(event); sendIndexLifecycleEvents(event); + notifyIndicesStateChanged(event); } } @@ -187,6 +190,13 @@ private void sendIndexLifecycleEvents(final ClusterChangedEvent event) { } } + private void notifyIndicesStateChanged(final ClusterChangedEvent event) { + //handles open/close index notifications + if (event.indicesStateChanged()) { + nodeIndicesStateUpdatedAction.nodeIndexStateUpdated(new NodeIndicesStateUpdatedAction.NodeIndexStateUpdatedResponse(event.state().nodes().localNodeId(), event.state().version())); + } + } + private void applyCleanedIndices(final ClusterChangedEvent event) { // handle closed indices, since they are not allocated on a node once they are closed // so applyDeletedIndices might not take them into account diff --git a/src/test/java/org/elasticsearch/test/integration/AbstractSharedClusterTest.java b/src/test/java/org/elasticsearch/test/integration/AbstractSharedClusterTest.java index 2f63ee648aa9e..9ac6738885b43 100644 --- a/src/test/java/org/elasticsearch/test/integration/AbstractSharedClusterTest.java +++ b/src/test/java/org/elasticsearch/test/integration/AbstractSharedClusterTest.java @@ -127,6 +127,10 @@ public static Client client() { return cluster().client(); } + public static Iterable<Client> clients() { + return cluster().clients(); + } + public ImmutableSettings.Builder randomSettingsBuilder() { // TODO RANDOMIZE return ImmutableSettings.builder(); diff --git a/src/test/java/org/elasticsearch/test/integration/indices/state/OpenCloseIndexTests.java b/src/test/java/org/elasticsearch/test/integration/indices/state/OpenCloseIndexTests.java index f2f5cd421b4d5..f5569aa7f7ba7 100644 --- a/src/test/java/org/elasticsearch/test/integration/indices/state/OpenCloseIndexTests.java +++ b/src/test/java/org/elasticsearch/test/integration/indices/state/OpenCloseIndexTests.java @@ -32,7 +32,6 @@ import org.elasticsearch.test.integration.AbstractSharedClusterTest; import org.junit.Test; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; @@ -273,6 +272,21 @@ public void testCloseOpenAliasMultipleIndices() { assertIndexIsOpened("test1", "test2"); } + @Test + public void testSimpleCloseOpenAcknowledged() { + createIndex("test1"); + ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); + assertThat(healthResponse.isTimedOut(), equalTo(false)); + + CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test1").execute().actionGet(); + assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); + assertIndexIsClosedOnAllNodes("test1"); + + OpenIndexResponse openIndexResponse = client().admin().indices().prepareOpen("test1").execute().actionGet(); + assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); + assertIndexIsOpenedOnAllNodes("test1"); + } + private void assertIndexIsOpened(String... indices) { checkIndexState(IndexMetaData.State.OPEN, indices); } @@ -281,12 +295,33 @@ private void assertIndexIsClosed(String... indices) { checkIndexState(IndexMetaData.State.CLOSE, indices); } - private void checkIndexState(IndexMetaData.State state, String... indices) { + private void assertIndexIsOpenedOnAllNodes(String... indices) { + checkIndexStateOnAllNodes(IndexMetaData.State.OPEN, indices); + } + + private void assertIndexIsClosedOnAllNodes(String... indices) { + checkIndexStateOnAllNodes(IndexMetaData.State.CLOSE, indices); + } + + private void checkIndexStateOnAllNodes(IndexMetaData.State state, String... indices) { + //we explicitly check the cluster state on all nodes forcing the local execution + // we want to make sure that acknowledged true means that all the nodes already hold the updated cluster state + for (Client client : clients()) { + ClusterStateResponse clusterStateResponse = client.admin().cluster().prepareState().setLocal(true).execute().actionGet(); + checkIndexState(state, clusterStateResponse, indices); + } + } + + private void checkIndexState(IndexMetaData.State expectedState, String... indices) { ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().execute().actionGet(); + checkIndexState(expectedState, clusterStateResponse, indices); + } + + private void checkIndexState(IndexMetaData.State expectedState, ClusterStateResponse clusterState, String... indices) { for (String index : indices) { - IndexMetaData indexMetaData = clusterStateResponse.getState().metaData().indices().get(index); + IndexMetaData indexMetaData = clusterState.getState().metaData().indices().get(index); assertThat(indexMetaData, notNullValue()); - assertThat(indexMetaData.getState(), equalTo(state)); + assertThat(indexMetaData.getState(), equalTo(expectedState)); } } } \ No newline at end of file
7147c843964a89cc4950ef8b9dc58cfe69aa974f
kotlin
Fix for KT-9897: Cannot pop operand off an empty- stack" with -= on ArrayList element-- -KT-9897 Fixed-
c
https://github.com/JetBrains/kotlin
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java index 9e39ca54dae40..7a421644f0c20 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java @@ -835,7 +835,10 @@ public static void pop(@NotNull MethodVisitor v, @NotNull Type type) { } public static void dup(@NotNull InstructionAdapter v, @NotNull Type type) { - int size = type.getSize(); + dup(v, type.getSize()); + } + + private static void dup(@NotNull InstructionAdapter v, int size) { if (size == 2) { v.dup2(); } @@ -847,6 +850,36 @@ else if (size == 1) { } } + public static void dup(@NotNull InstructionAdapter v, @NotNull Type topOfStack, @NotNull Type afterTop) { + if (topOfStack.getSize() == 0 && afterTop.getSize() == 0) { + return; + } + + if (topOfStack.getSize() == 0) { + dup(v, afterTop); + } + else if (afterTop.getSize() == 0) { + dup(v, topOfStack); + } + else if (afterTop.getSize() == 1) { + if (topOfStack.getSize() == 1) { + dup(v, 2); + } + else { + v.dup2X1(); + v.pop2(); + v.dupX2(); + v.dupX2(); + v.pop(); + v.dup2X1(); + } + } + else { + //Note: it's possible to write dup3 and dup4 + throw new UnsupportedOperationException("Don't know how generate dup3/dup4 for: " + topOfStack + " and " + afterTop); + } + } + public static void writeKotlinSyntheticClassAnnotation(@NotNull ClassBuilder v, @NotNull GenerationState state) { AnnotationVisitor av = v.newAnnotation(asmDescByFqNameWithoutInnerClasses(KOTLIN_SYNTHETIC_CLASS), true); JvmCodegenUtil.writeAbiVersion(av); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java index 875d3d24bbdf3..03ff9b57ef631 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java @@ -771,12 +771,12 @@ public static class CollectionElementReceiver extends StackValue { private final boolean isGetter; private final ExpressionCodegen codegen; private final ArgumentGenerator argumentGenerator; - final List<ResolvedValueArgument> valueArguments; + private final List<ResolvedValueArgument> valueArguments; private final FrameMap frame; private final StackValue receiver; private final ResolvedCall<FunctionDescriptor> resolvedGetCall; private final ResolvedCall<FunctionDescriptor> resolvedSetCall; - DefaultCallMask mask; + private DefaultCallMask mask; public CollectionElementReceiver( @NotNull Callable callable, @@ -1424,6 +1424,11 @@ public void putSelector(@NotNull Type type, @NotNull InstructionAdapter v) { currentExtensionReceiver .moveToTopOfStack(hasExtensionReceiver ? type : currentExtensionReceiver.type, v, dispatchReceiver.type.getSize()); } + + @Override + public void dup(@NotNull InstructionAdapter v, boolean withReceiver) { + AsmUtil.dup(v, extensionReceiver.type, dispatchReceiver.type); + } } public abstract static class StackValueWithSimpleReceiver extends StackValue { diff --git a/compiler/testData/codegen/box/extensionProperties/kt9897.kt b/compiler/testData/codegen/box/extensionProperties/kt9897.kt new file mode 100644 index 0000000000000..728323b1c649d --- /dev/null +++ b/compiler/testData/codegen/box/extensionProperties/kt9897.kt @@ -0,0 +1,41 @@ +object Test { + var z = "0" + var l = 0L + + fun changeObject(): String { + "1".someProperty += 1 + return z + } + + fun changeLong(): Long { + 2L.someProperty -= 1 + return l + } + + var String.someProperty: Int + get() { + return this.length + } + set(left) { + z += this + left + } + + var Long.someProperty: Long + get() { + return l + } + set(left) { + l += this + left + } + +} + +fun box(): String { + val changeObject = Test.changeObject() + if (changeObject != "012") return "fail 1: $changeObject" + + val changeLong = Test.changeLong() + if (changeLong != 1L) return "fail 1: $changeLong" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/extensionProperties/kt9897_topLevel.kt b/compiler/testData/codegen/box/extensionProperties/kt9897_topLevel.kt new file mode 100644 index 0000000000000..9ff0dd42c2291 --- /dev/null +++ b/compiler/testData/codegen/box/extensionProperties/kt9897_topLevel.kt @@ -0,0 +1,38 @@ +var z = "0" +var l = 0L + +fun changeObject(): String { + "1".someProperty += 1 + return z +} + +fun changeLong(): Long { + 2L.someProperty -= 1 + return l +} + +var String.someProperty: Int + get() { + return this.length + } + set(left) { + z += this + left + } + +var Long.someProperty: Long + get() { + return l + } + set(left) { + l += this + left + } + +fun box(): String { + val changeObject = changeObject() + if (changeObject != "012") return "fail 1: $changeObject" + + val changeLong = changeLong() + if (changeLong != 1L) return "fail 1: $changeLong" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/jvmStatic/kt9897_static.kt b/compiler/testData/codegen/boxWithStdlib/jvmStatic/kt9897_static.kt new file mode 100644 index 0000000000000..66559576b7bc7 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/jvmStatic/kt9897_static.kt @@ -0,0 +1,41 @@ +object Test { + var z = "0" + var l = 0L + + fun changeObject(): String { + "1".someProperty += 1 + return z + } + + fun changeLong(): Long { + 2L.someProperty -= 1 + return l + } + + @JvmStatic var String.someProperty: Int + get() { + return this.length + } + set(left) { + z += this + left + } + + @JvmStatic var Long.someProperty: Long + get() { + return l + } + set(left) { + l += this + left + } + +} + +fun box(): String { + val changeObject = Test.changeObject() + if (changeObject != "012") return "fail 1: $changeObject" + + val changeLong = Test.changeLong() + if (changeLong != 1L) return "fail 1: $changeLong" + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java index f9b23efc1bfff..982367afb326e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java @@ -3883,6 +3883,18 @@ public void testInClassWithSetter() throws Exception { doTest(fileName); } + @TestMetadata("kt9897.kt") + public void testKt9897() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/extensionProperties/kt9897.kt"); + doTest(fileName); + } + + @TestMetadata("kt9897_topLevel.kt") + public void testKt9897_topLevel() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/extensionProperties/kt9897_topLevel.kt"); + doTest(fileName); + } + @TestMetadata("topLevel.kt") public void testTopLevel() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/extensionProperties/topLevel.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java index 18c59b627891e..1ae3240bb9dc3 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java @@ -2299,6 +2299,12 @@ public void testInline() throws Exception { doTestWithStdlib(fileName); } + @TestMetadata("kt9897_static.kt") + public void testKt9897_static() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/jvmStatic/kt9897_static.kt"); + doTestWithStdlib(fileName); + } + @TestMetadata("postfixInc.kt") public void testPostfixInc() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/jvmStatic/postfixInc.kt");
954582943efddc51245c74ebeaeb1b218aa05668
restlet-framework-java
- Refactored WADL extension based on John- Logsdon feed-back. Add convenience methods and constructors on- MethodInfo and RepresentationInfo. Removed unecessary methods on - WadlResource like getRepresentationInfo(Variant) and - getParametersInfo(RequestInfo|ResponseInfo|Representation- Info).--
p
https://github.com/restlet/restlet-framework-java
diff --git a/build/tmpl/text/changes.txt b/build/tmpl/text/changes.txt index 2d0bc382b8..e9142e9d0e 100644 --- a/build/tmpl/text/changes.txt +++ b/build/tmpl/text/changes.txt @@ -15,7 +15,12 @@ Changes log - Added the ability to provide Wadl documentation to any Restlet instances. - NRE and Extension Enhancements - - + - Refactored WADL extension based on John Logsdon feed-back. + Add convenience methods and constructors on MethodInfo and + RepresentationInfo. Removed unecessary methods on + WadlResource like getRepresentationInfo(Variant) and + getParametersInfo(RequestInfo|ResponseInfo|Representation- + Info). - Misc - diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java index 4b720dd46f..5ac681ffc5 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java @@ -34,6 +34,7 @@ import org.restlet.data.Method; import org.restlet.data.Reference; +import org.restlet.resource.Variant; import org.restlet.util.XmlWriter; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; @@ -97,6 +98,78 @@ public MethodInfo(String documentation) { super(documentation); } + /** + * Adds a new request parameter. + * + * @param name + * The name of the parameter. + * @param required + * True if thes parameter is required. + * @param type + * The type of the parameter. + * @param style + * The style of the parameter. + * @param documentation + * A single documentation element. + * @return The created parameter description. + */ + public ParameterInfo addRequestParameter(String name, boolean required, + String type, ParameterStyle style, String documentation) { + ParameterInfo result = new ParameterInfo(name, required, type, style, + documentation); + getRequest().getParameters().add(result); + return result; + } + + /** + * Adds a new request representation based on a given variant. + * + * @param variant + * The variant to describe. + * @return The created representation description. + */ + public RepresentationInfo addRequestRepresentation(Variant variant) { + RepresentationInfo result = new RepresentationInfo(variant); + getRequest().getRepresentations().add(result); + return result; + } + + /** + * Adds a new response parameter. + * + * @param name + * The name of the parameter. + * @param required + * True if thes parameter is required. + * @param type + * The type of the parameter. + * @param style + * The style of the parameter. + * @param documentation + * A single documentation element. + * @return The created parameter description. + */ + public ParameterInfo addResponseParameter(String name, boolean required, + String type, ParameterStyle style, String documentation) { + ParameterInfo result = new ParameterInfo(name, required, type, style, + documentation); + getResponse().getParameters().add(result); + return result; + } + + /** + * Adds a new response representation based on a given variant. + * + * @param variant + * The variant to describe. + * @return The created representation description. + */ + public RepresentationInfo addResponseRepresentation(Variant variant) { + RepresentationInfo result = new RepresentationInfo(variant); + getResponse().getRepresentations().add(result); + return result; + } + /** * Returns the identifier for the method. * diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java index 48ff697de8..d63d13d7d0 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java @@ -37,6 +37,7 @@ import org.restlet.data.MediaType; import org.restlet.data.Reference; import org.restlet.data.Status; +import org.restlet.resource.Variant; import org.restlet.util.XmlWriter; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; @@ -105,6 +106,16 @@ public RepresentationInfo(String documentation) { super(documentation); } + /** + * Constructor with a variant. + * + * @param variant + * The variant to describe. + */ + public RepresentationInfo(Variant variant) { + setMediaType(variant.getMediaType()); + } + /** * Returns the identifier for that element. * diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java index 62967f02f8..0e3f526d6a 100644 --- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java +++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java @@ -196,16 +196,10 @@ protected void describeDelete(MethodInfo methodInfo) { * The method description to update. */ protected void describeGet(MethodInfo methodInfo) { - ResponseInfo responseInfo = new ResponseInfo(); - // Describe each variant for (final Variant variant : getVariants()) { - responseInfo.getRepresentations().add( - getRepresentationInfo(variant)); + methodInfo.addResponseRepresentation(variant); } - - methodInfo.setResponse(responseInfo); - } /** @@ -218,6 +212,8 @@ protected void describeGet(MethodInfo methodInfo) { */ protected void describeMethod(Method method, MethodInfo methodInfo) { methodInfo.setName(method); + methodInfo.setRequest(new RequestInfo()); + methodInfo.setResponse(new ResponseInfo()); if (Method.GET.equals(method)) { describeGet(methodInfo); @@ -241,15 +237,10 @@ protected void describeMethod(Method method, MethodInfo methodInfo) { * The method description to update. */ protected void describeOptions(MethodInfo methodInfo) { - ResponseInfo responseInfo = new ResponseInfo(); - // Describe each variant for (final Variant variant : getWadlVariants()) { - responseInfo.getRepresentations().add( - getRepresentationInfo(variant)); + methodInfo.addResponseRepresentation(variant); } - - methodInfo.setResponse(responseInfo); } /** @@ -281,46 +272,6 @@ protected List<ParameterInfo> getParametersInfo() { return result; } - /** - * Returns the description of the parameters of the given representation. - * Returns null by default. - * - * @param representation - * The parent representation. - * @return The description of the parameters. - */ - protected List<ParameterInfo> getParametersInfo( - RepresentationInfo representation) { - final List<ParameterInfo> result = null; - return result; - } - - /** - * Returns the description of the parameters of the given request. Returns - * null by default. - * - * @param request - * The parent request. - * @return The description of the parameters. - */ - protected List<ParameterInfo> getParametersInfo(RequestInfo request) { - final List<ParameterInfo> result = null; - return result; - } - - /** - * Returns the description of the parameters of the given response. Returns - * null by default. - * - * @param response - * The parent response. - * @return The description of the parameters. - */ - protected List<ParameterInfo> getParametersInfo(ResponseInfo response) { - final List<ParameterInfo> result = null; - return result; - } - /** * Returns the preferred WADL variant according to the client preferences * specified in the request. @@ -345,20 +296,6 @@ protected Variant getPreferredWadlVariant() { return result; } - /** - * Returns a WADL description for a given variant. - * - * @param variant - * The variant to describe. - * @return The variant description. - */ - protected RepresentationInfo getRepresentationInfo(Variant variant) { - final RepresentationInfo result = new RepresentationInfo(); - result.setMediaType(variant.getMediaType()); - result.setParameters(getParametersInfo(result)); - return result; - } - /** * Returns the resource's relative path. *
33dfd5bb6b66becf4009345170ead16bfc50abd3
kotlin
Lazy resolve: Package-level objects are handled- properly--
c
https://github.com/JetBrains/kotlin
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyMemberScope.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyMemberScope.java index c81721e2559c0..badc29026a09a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyMemberScope.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyMemberScope.java @@ -145,7 +145,10 @@ public Set<VariableDescriptor> getProperties(@NotNull Name name) { JetClassOrObject classOrObjectDeclaration = declarationProvider.getClassOrObjectDeclaration(name); if (classOrObjectDeclaration instanceof JetObjectDeclaration) { JetObjectDeclaration objectDeclaration = (JetObjectDeclaration) classOrObjectDeclaration; - ClassDescriptor classifier = (ClassDescriptor) getClassifier(name); + ClassDescriptor classifier = getObjectDescriptor(name); + if (classifier == null) { + throw new IllegalStateException("Object declaration " + name + " found in the DeclarationProvider " + declarationProvider + " but not in the scope " + this); + } VariableDescriptor propertyDescriptor = resolveSession.getInjector().getDescriptorResolver() .resolveObjectDeclaration(thisDescriptor, objectDeclaration, classifier, resolveSession.getTrace()); result.add(propertyDescriptor); diff --git a/compiler/testData/lazyResolve/namespaceComparator/packageLevelObject.kt b/compiler/testData/lazyResolve/namespaceComparator/packageLevelObject.kt new file mode 100644 index 0000000000000..dc2194f9876c5 --- /dev/null +++ b/compiler/testData/lazyResolve/namespaceComparator/packageLevelObject.kt @@ -0,0 +1,4 @@ +package foo + +object Bar { +} \ No newline at end of file diff --git a/compiler/testData/lazyResolve/namespaceComparator/packageLevelObject.txt b/compiler/testData/lazyResolve/namespaceComparator/packageLevelObject.txt new file mode 100644 index 0000000000000..10ca6ab510ddb --- /dev/null +++ b/compiler/testData/lazyResolve/namespaceComparator/packageLevelObject.txt @@ -0,0 +1,7 @@ +namespace <root> + +// <namespace name="foo"> +namespace foo + +internal final val Bar: foo.Bar +// </namespace name="foo"> diff --git a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveNamespaceComparingTestGenerated.java b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveNamespaceComparingTestGenerated.java index ca8f45fa83b4d..87b06fc4aae9c 100644 --- a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveNamespaceComparingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveNamespaceComparingTestGenerated.java @@ -1275,6 +1275,11 @@ public void testGenericFunction() throws Exception { doTest("compiler/testData/lazyResolve/namespaceComparator/genericFunction.kt"); } + @TestMetadata("packageLevelObject.kt") + public void testPackageLevelObject() throws Exception { + doTest("compiler/testData/lazyResolve/namespaceComparator/packageLevelObject.kt"); + } + @TestMetadata("simpleClass.kt") public void testSimpleClass() throws Exception { doTest("compiler/testData/lazyResolve/namespaceComparator/simpleClass.kt");
d77c6eb30ee1f173c65bedabf25f138c9a4e50f2
kotlin
Exception fix: diagnose an error for a generic- type which is a subtype of itself, a set of tests -EA-64453 Fixed--
c
https://github.com/JetBrains/kotlin
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 0daa6285114b3..0f6bb6582b50d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -249,6 +249,8 @@ public interface Errors { DiagnosticFactory0<JetDeclaration> TYPE_PARAMETERS_NOT_ALLOWED = DiagnosticFactory0.create(ERROR, TYPE_PARAMETERS_OR_DECLARATION_SIGNATURE); + DiagnosticFactory0<PsiElement> CYCLIC_GENERIC_UPPER_BOUND = DiagnosticFactory0.create(ERROR); + // Members DiagnosticFactory0<JetModifierListOwner> PACKAGE_MEMBER_CANNOT_BE_PROTECTED = diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 4272678d51f73..69c0bd405ffe6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -421,6 +421,7 @@ public String render(@NotNull JetExpression expression) { MAP.put(TYPE_MISMATCH_IN_RANGE, "Type mismatch: incompatible types of range and element checked in it"); MAP.put(CYCLIC_INHERITANCE_HIERARCHY, "There's a cycle in the inheritance hierarchy for this type"); + MAP.put(CYCLIC_GENERIC_UPPER_BOUND, "Type parameter has itself as an upper bound"); MAP.put(MANY_CLASSES_IN_SUPERTYPE_LIST, "Only one class may appear in a supertype list"); MAP.put(SUPERTYPE_NOT_A_CLASS_OR_TRAIT, "Only classes and interfaces may serve as supertypes"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index 5e23f7bef6c82..6bbac29d8f4f3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -28,6 +28,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations; import org.jetbrains.kotlin.descriptors.impl.*; import org.jetbrains.kotlin.diagnostics.DiagnosticFactory1; +import org.jetbrains.kotlin.diagnostics.Errors; import org.jetbrains.kotlin.lexer.JetKeywordToken; import org.jetbrains.kotlin.lexer.JetModifierKeywordToken; import org.jetbrains.kotlin.lexer.JetTokens; @@ -476,6 +477,10 @@ public void resolveGenericBounds( JetTypeReference extendsBound = jetTypeParameter.getExtendsBound(); if (extendsBound != null) { JetType type = typeResolver.resolveType(scope, extendsBound, trace, false); + if (type.getConstructor().equals(typeParameterDescriptor.getTypeConstructor())) { + trace.report(Errors.CYCLIC_GENERIC_UPPER_BOUND.on(extendsBound)); + type = ErrorUtils.createErrorType("Cyclic upper bound: " + type); + } typeParameterDescriptor.addUpperBound(type); deferredUpperBoundCheckerTasks.add(new UpperBoundCheckerTask(extendsBound, type)); } diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBound.kt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBound.kt new file mode 100644 index 0000000000000..7bc7846fc26bc --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBound.kt @@ -0,0 +1,3 @@ +// !DIAGNOSTICS: -MUST_BE_INITIALIZED +fun <T: <!CYCLIC_GENERIC_UPPER_BOUND!>T?<!>> foo() {} +val <T: <!CYCLIC_GENERIC_UPPER_BOUND!>T?<!>> prop diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBound.txt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBound.txt new file mode 100644 index 0000000000000..e9d759332ac62 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBound.txt @@ -0,0 +1,4 @@ +package + +internal val </*0*/ T : [ERROR : Cyclic upper bound: T?]> prop: [ERROR : No type, no body] +internal fun </*0*/ T : [ERROR : Cyclic upper bound: T?]> foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.kt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.kt new file mode 100644 index 0000000000000..353988510c342 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.kt @@ -0,0 +1,4 @@ +fun bar() { + fun <T: <!CYCLIC_GENERIC_UPPER_BOUND!>T?<!>> foo() {} + foo() +} diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.txt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.txt new file mode 100644 index 0000000000000..b015afc1ae045 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.txt @@ -0,0 +1,3 @@ +package + +internal fun bar(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundMember.kt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundMember.kt new file mode 100644 index 0000000000000..91cc9ac8fc22d --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundMember.kt @@ -0,0 +1,5 @@ +// !DIAGNOSTICS: -MUST_BE_INITIALIZED_OR_BE_ABSTRACT +class My { + fun <T: <!CYCLIC_GENERIC_UPPER_BOUND!>T?<!>> foo() {} + val <T: <!CYCLIC_GENERIC_UPPER_BOUND!>T?<!>> prop: T +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundMember.txt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundMember.txt new file mode 100644 index 0000000000000..213f4fddd6446 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundMember.txt @@ -0,0 +1,10 @@ +package + +internal final class My { + public constructor My() + internal final val </*0*/ T : [ERROR : Cyclic upper bound: T?]> prop: [ERROR : ?] + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + internal final fun </*0*/ T : [ERROR : Cyclic upper bound: T?]> foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundNotNull.kt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundNotNull.kt new file mode 100644 index 0000000000000..3700e3f423698 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundNotNull.kt @@ -0,0 +1,3 @@ +// !DIAGNOSTICS: -MUST_BE_INITIALIZED +fun <T: <!CYCLIC_GENERIC_UPPER_BOUND!>T<!>> foo() {} +val <T: <!CYCLIC_GENERIC_UPPER_BOUND!>T?<!>> prop: T diff --git a/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundNotNull.txt b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundNotNull.txt new file mode 100644 index 0000000000000..78109cf302724 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundNotNull.txt @@ -0,0 +1,4 @@ +package + +internal val </*0*/ T : [ERROR : Cyclic upper bound: T?]> prop: [ERROR : ?] +internal fun </*0*/ T : [ERROR : Cyclic upper bound: T]> foo(): kotlin.Unit diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 3d746285e0495..c3fba608824c5 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -10224,6 +10224,30 @@ public void testErrorsOnIbjectExpressionsAsParameters() throws Exception { doTest(fileName); } + @TestMetadata("itselfAsUpperBound.kt") + public void testItselfAsUpperBound() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/itselfAsUpperBound.kt"); + doTest(fileName); + } + + @TestMetadata("itselfAsUpperBoundLocal.kt") + public void testItselfAsUpperBoundLocal() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundLocal.kt"); + doTest(fileName); + } + + @TestMetadata("itselfAsUpperBoundMember.kt") + public void testItselfAsUpperBoundMember() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundMember.kt"); + doTest(fileName); + } + + @TestMetadata("itselfAsUpperBoundNotNull.kt") + public void testItselfAsUpperBoundNotNull() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/itselfAsUpperBoundNotNull.kt"); + doTest(fileName); + } + @TestMetadata("Jet11.kt") public void testJet11() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/Jet11.kt");
4fa174541fd3402cc067ebab5fb44c9b5ce2587e
camel
CAMEL-3203: Fixed adding routes with quartz- endpoints to already started camel should add jobs to scheduler.--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@1005489 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/camel
diff --git a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java index 9ff9bf8cb7515..1ef0cdf81b779 100644 --- a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java +++ b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java @@ -186,9 +186,14 @@ protected void doStop() throws Exception { } } - public void addJob(JobDetail job, Trigger trigger) { - // add job to internal list because we will defer adding to the scheduler when camel context has been fully started - jobsToAdd.add(new JobToAdd(job, trigger)); + public void addJob(JobDetail job, Trigger trigger) throws SchedulerException { + if (scheduler == null) { + // add job to internal list because we will defer adding to the scheduler when camel context has been fully started + jobsToAdd.add(new JobToAdd(job, trigger)); + } else { + // add job directly to scheduler + doAddJob(job, trigger); + } } private void doAddJob(JobDetail job, Trigger trigger) throws SchedulerException { diff --git a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzAddRoutesAfterCamelContextStartedTest.java b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzAddRoutesAfterCamelContextStartedTest.java new file mode 100644 index 0000000000000..52503df24ec5a --- /dev/null +++ b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzAddRoutesAfterCamelContextStartedTest.java @@ -0,0 +1,49 @@ +/** + * 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.apache.camel.component.quartz; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +/** + * @version $Revision$ + */ +public class QuartzAddRoutesAfterCamelContextStartedTest extends CamelTestSupport { + + @Test + public void testAddRoutes() throws Exception { + // camel context should already be started + assertTrue(context.getStatus().isStarted()); + + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMessageCount(2); + + // add the quartz router after CamelContext has been started + context.addRoutes(new RouteBuilder() { + @Override + public void configure() throws Exception { + from("quartz://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1").to("mock:result"); + } + }); + + // it should also work + assertMockEndpointsSatisfied(); + } + +}
2136542f1bbca3cfcad3107365015c103f5b42ae
hadoop
YARN-632. Changed ContainerManager api to throw- IOException and YarnRemoteException. Contributed by Xuan Gong. svn merge- --ignore-ancestry -c 1479740 ../../trunk/--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1479741 13f79535-47bb-0310-9956-ffa450edef68-
p
https://github.com/apache/hadoop
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 22876e4f070e5..a83cc29faaae7 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -37,6 +37,9 @@ Release 2.0.5-beta - UNRELEASED YARN-633. Changed RMAdminProtocol api to throw IOException and YarnRemoteException. (Xuan Gong via vinodkv) + YARN-632. Changed ContainerManager api to throw IOException and + YarnRemoteException. (Xuan Gong via vinodkv) + NEW FEATURES YARN-482. FS: Extend SchedulingMode to intermediate queues. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManager.java index 0bb559a9fc557..0961ac4e4d766 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManager.java @@ -18,6 +18,8 @@ package org.apache.hadoop.yarn.api; +import java.io.IOException; + import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusRequest; @@ -68,11 +70,12 @@ public interface ContainerManager { * @return empty response to indicate acceptance of the request * or an exception * @throws YarnRemoteException + * @throws IOException */ @Public @Stable StartContainerResponse startContainer(StartContainerRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** * <p>The <code>ApplicationMaster</code> requests a <code>NodeManager</code> @@ -94,11 +97,12 @@ StartContainerResponse startContainer(StartContainerRequest request) * @return empty response to indicate acceptance of the request * or an exception * @throws YarnRemoteException + * @throws IOException */ @Public @Stable StopContainerResponse stopContainer(StopContainerRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** * <p>The api used by the <code>ApplicationMaster</code> to request for @@ -118,9 +122,11 @@ StopContainerResponse stopContainer(StopContainerRequest request) * @return response containing the <code>ContainerStatus</code> of the * container * @throws YarnRemoteException + * @throws IOException */ @Public @Stable GetContainerStatusResponse getContainerStatus( - GetContainerStatusRequest request) throws YarnRemoteException; + GetContainerStatusRequest request) throws YarnRemoteException, + IOException; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java index d46be9760900c..c311a34a33b9b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java @@ -759,6 +759,10 @@ public void run() { + container.getId()); e.printStackTrace(); // TODO do we need to release this container? + } catch (IOException e) { + LOG.info("Start container failed for :" + ", containerId=" + + container.getId()); + e.printStackTrace(); } // Get container status? diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ContainerManagerPBServiceImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ContainerManagerPBServiceImpl.java index 4b0af8156d2c2..19eefff1a997c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ContainerManagerPBServiceImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ContainerManagerPBServiceImpl.java @@ -18,6 +18,8 @@ package org.apache.hadoop.yarn.api.impl.pb.service; +import java.io.IOException; + import org.apache.hadoop.yarn.api.ContainerManager; import org.apache.hadoop.yarn.api.ContainerManagerPB; import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusResponse; @@ -57,6 +59,8 @@ public GetContainerStatusResponseProto getContainerStatus(RpcController arg0, return ((GetContainerStatusResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -69,6 +73,8 @@ public StartContainerResponseProto startContainer(RpcController arg0, return ((StartContainerResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -81,6 +87,8 @@ public StopContainerResponseProto stopContainer(RpcController arg0, return ((StopContainerResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java index 8e3ef455f9b67..68891103ed8a7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java @@ -396,7 +396,7 @@ private void authorizeRequest(String containerIDStr, @SuppressWarnings("unchecked") @Override public StartContainerResponse startContainer(StartContainerRequest request) - throws YarnRemoteException { + throws YarnRemoteException, IOException { if (blockNewContainerRequests.get()) { throw RPCUtil.getRemoteException(new NMNotYetReadyException( @@ -503,7 +503,7 @@ public StartContainerResponse startContainer(StartContainerRequest request) @Override @SuppressWarnings("unchecked") public StopContainerResponse stopContainer(StopContainerRequest request) - throws YarnRemoteException { + throws YarnRemoteException, IOException { ContainerId containerID = request.getContainerId(); String containerIDStr = containerID.toString(); @@ -545,7 +545,8 @@ public StopContainerResponse stopContainer(StopContainerRequest request) @Override public GetContainerStatusResponse getContainerStatus( - GetContainerStatusRequest request) throws YarnRemoteException { + GetContainerStatusRequest request) throws YarnRemoteException, + IOException { ContainerId containerID = request.getContainerId(); String containerIDStr = containerID.toString(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java index c1b9ef378472c..5f73d2d105313 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java @@ -299,6 +299,8 @@ public void run() { // class name after YARN-142 Assert.assertTrue(e.getRemoteTrace().contains( NMNotYetReadyException.class.getName())); + } catch (IOException e) { + assertionFailedInThread.set(true); } } // no. of containers to be launched should equal to no. of diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java index 7da531ece5670..102c77d223094 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java @@ -185,13 +185,13 @@ public void tearDown() throws IOException, InterruptedException { public static void waitForContainerState(ContainerManager containerManager, ContainerId containerID, ContainerState finalState) - throws InterruptedException, YarnRemoteException { + throws InterruptedException, YarnRemoteException, IOException { waitForContainerState(containerManager, containerID, finalState, 20); } public static void waitForContainerState(ContainerManager containerManager, ContainerId containerID, ContainerState finalState, int timeOutMax) - throws InterruptedException, YarnRemoteException { + throws InterruptedException, YarnRemoteException, IOException { GetContainerStatusRequest request = recordFactory.newRecordInstance(GetContainerStatusRequest.class); request.setContainerId(containerID); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java index a4081130da2cf..e0a35eb2f5b3c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java @@ -531,6 +531,9 @@ void callWithIllegalContainerID(ContainerManager client, "Unauthorized request to start container. " + "\nExpected containerId: " + tokenId.getContainerID() + " Found: " + newContainerId.toString())); + } catch (IOException e) { + LOG.info("Got IOException: ",e); + fail("IOException is not expected."); } } @@ -557,6 +560,9 @@ void callWithIllegalResource(ContainerManager client, Assert.assertTrue(e.getMessage().contains( "\nExpected resource " + tokenId.getResource().toString() + " but found " + container.getResource().toString())); + } catch (IOException e) { + LOG.info("Got IOException: ",e); + fail("IOException is not expected."); } } @@ -585,6 +591,9 @@ void callWithIllegalUserName(ContainerManager client, Assert.assertTrue(e.getMessage().contains( "Expected user-name " + tokenId.getApplicationSubmitter() + " but found " + context.getUser())); + } catch (IOException e) { + LOG.info("Got IOException: ",e); + fail("IOException is not expected."); } }
e6897e844505bfdfff46cfc91d9e122002f3e6a5
orientdb
first implementation of binary record serializer- debug info. issue -4027--
a
https://github.com/orientechnologies/orientdb
diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializationDebug.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializationDebug.java new file mode 100644 index 00000000000..a90e217af70 --- /dev/null +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializationDebug.java @@ -0,0 +1,13 @@ +package com.orientechnologies.orient.core.serialization.serializer.record.binary; + +import java.util.ArrayList; + +public class ORecordSerializationDebug { + + public String className; + public ArrayList<ORecordSerializationDebugProperty> properties; + public boolean readingFailure; + public RuntimeException readingException; + public int failPosition; + +} diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializationDebugProperty.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializationDebugProperty.java new file mode 100644 index 00000000000..1e1f671fa95 --- /dev/null +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializationDebugProperty.java @@ -0,0 +1,15 @@ +package com.orientechnologies.orient.core.serialization.serializer.record.binary; + +import com.orientechnologies.orient.core.metadata.schema.OType; + +public class ORecordSerializationDebugProperty { + + public String name; + public int globalId; + public OType type; + public RuntimeException readingException; + public boolean faildToRead; + public int failPosition; + public Object value; + +} diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializerBinaryDebug.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializerBinaryDebug.java new file mode 100644 index 00000000000..d2b294a2419 --- /dev/null +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializerBinaryDebug.java @@ -0,0 +1,93 @@ +package com.orientechnologies.orient.core.serialization.serializer.record.binary; + +import java.util.ArrayList; + +import com.orientechnologies.common.exception.OException; +import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; +import com.orientechnologies.orient.core.metadata.OMetadataInternal; +import com.orientechnologies.orient.core.metadata.schema.OGlobalProperty; +import com.orientechnologies.orient.core.metadata.schema.OImmutableSchema; +import com.orientechnologies.orient.core.metadata.schema.OType; +import com.orientechnologies.orient.core.record.impl.ODocument; + +public class ORecordSerializerBinaryDebug extends ORecordSerializerBinaryV0 { + + public ORecordSerializationDebug deserializeDebug(final byte[] iSource, ODatabaseDocumentTx db) { + ORecordSerializationDebug debugInfo = new ORecordSerializationDebug(); + OImmutableSchema schema = ((OMetadataInternal) db.getMetadata()).getImmutableSchemaSnapshot(); + BytesContainer bytes = new BytesContainer(iSource); + if (bytes.bytes[0] != 0) + throw new OException("Unsupported binary serialization version"); + bytes.skip(1); + try { + final String className = readString(bytes); + debugInfo.className = className; + } catch (RuntimeException ex) { + debugInfo.readingFailure = true; + debugInfo.readingException = ex; + debugInfo.failPosition = bytes.offset; + return debugInfo; + } + + debugInfo.properties = new ArrayList<ORecordSerializationDebugProperty>(); + int last = 0; + String fieldName; + int valuePos; + OType type; + while (true) { + ORecordSerializationDebugProperty debugProperty = new ORecordSerializationDebugProperty(); + OGlobalProperty prop = null; + try { + final int len = OVarIntSerializer.readAsInteger(bytes); + if (len != 0) + debugInfo.properties.add(debugProperty); + if (len == 0) { + // SCAN COMPLETED + break; + } else if (len > 0) { + // PARSE FIELD NAME + fieldName = stringFromBytes(bytes.bytes, bytes.offset, len).intern(); + bytes.skip(len); + valuePos = readInteger(bytes); + type = readOType(bytes); + } else { + // LOAD GLOBAL PROPERTY BY ID + final int id = (len * -1) - 1; + debugProperty.globalId = id; + prop = schema.getGlobalPropertyById(id); + fieldName = prop.getName(); + valuePos = readInteger(bytes); + if (prop.getType() != OType.ANY) + type = prop.getType(); + else + type = readOType(bytes); + } + debugProperty.name = fieldName; + debugProperty.type = type; + + if (valuePos != 0) { + int headerCursor = bytes.offset; + bytes.offset = valuePos; + try { + debugProperty.value = readSingleValue(bytes, type, new ODocument()); + } catch (RuntimeException ex) { + debugProperty.faildToRead = true; + debugProperty.readingException = ex; + debugProperty.failPosition = bytes.offset; + } + if (bytes.offset > last) + last = bytes.offset; + bytes.offset = headerCursor; + } else + debugProperty.value = null; + } catch (RuntimeException ex) { + debugInfo.readingFailure = true; + debugInfo.readingException = ex; + debugInfo.failPosition = bytes.offset; + return debugInfo; + } + } + + return debugInfo; + } +} diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializerBinaryV0.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializerBinaryV0.java index 1b8f179c7fb..817eb75926b 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializerBinaryV0.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/ORecordSerializerBinaryV0.java @@ -273,12 +273,12 @@ protected OClass serializeClass(final ODocument document, final BytesContainer b return clazz; } - private OGlobalProperty getGlobalProperty(final ODocument document, final int len) { + protected OGlobalProperty getGlobalProperty(final ODocument document, final int len) { final int id = (len * -1) - 1; return ODocumentInternal.getGlobalPropertyById(document, id); } - private OType readOType(final BytesContainer bytes) { + protected OType readOType(final BytesContainer bytes) { return OType.getById(readByte(bytes)); } @@ -286,7 +286,7 @@ private void writeOType(BytesContainer bytes, int pos, OType type) { bytes.bytes[pos] = (byte) type.getId(); } - private Object readSingleValue(BytesContainer bytes, OType type, ODocument document) { + protected Object readSingleValue(BytesContainer bytes, OType type, ODocument document) { Object value = null; switch (type) { case INTEGER: @@ -748,14 +748,14 @@ private OType getTypeFromValueEmbedded(final Object fieldValue) { return type; } - private String readString(final BytesContainer bytes) { + protected String readString(final BytesContainer bytes) { final int len = OVarIntSerializer.readAsInteger(bytes); final String res = stringFromBytes(bytes.bytes, bytes.offset, len); bytes.skip(len); return res; } - private int readInteger(final BytesContainer container) { + protected int readInteger(final BytesContainer container) { final int value = OIntegerSerializer.INSTANCE.deserializeLiteral(container.bytes, container.offset); container.offset += OIntegerSerializer.INT_SIZE; return value; @@ -791,7 +791,7 @@ private byte[] bytesFromString(final String toWrite) { } } - private String stringFromBytes(final byte[] bytes, final int offset, final int len) { + protected String stringFromBytes(final byte[] bytes, final int offset, final int len) { try { return new String(bytes, offset, len, CHARSET_UTF_8); } catch (UnsupportedEncodingException e) { diff --git a/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/ORecordSerializerBinaryDebugTest.java b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/ORecordSerializerBinaryDebugTest.java new file mode 100644 index 00000000000..dba8275f0a2 --- /dev/null +++ b/core/src/test/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/ORecordSerializerBinaryDebugTest.java @@ -0,0 +1,163 @@ +package com.orientechnologies.orient.core.serialization.serializer.binary.impl; + +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; + +import org.testng.annotations.Test; + +import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; +import com.orientechnologies.orient.core.metadata.schema.OClass; +import com.orientechnologies.orient.core.metadata.schema.OType; +import com.orientechnologies.orient.core.record.impl.ODocument; +import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializationDebug; +import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinaryDebug; + +public class ORecordSerializerBinaryDebugTest { + + @Test + public void testSimpleDocumentDebug() { + ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:" + ORecordSerializerBinaryDebugTest.class.getSimpleName()); + db.create(); + try { + ODocument doc = new ODocument(); + doc.field("test", "test"); + doc.field("anInt", 2); + doc.field("anDouble", 2D); + + byte[] bytes = doc.toStream(); + + ORecordSerializerBinaryDebug debugger = new ORecordSerializerBinaryDebug(); + ORecordSerializationDebug debug = debugger.deserializeDebug(bytes, db); + + assertEquals(debug.properties.size(), 3); + assertEquals(debug.properties.get(0).name, "test"); + assertEquals(debug.properties.get(0).type, OType.STRING); + assertEquals(debug.properties.get(0).value, "test"); + + assertEquals(debug.properties.get(1).name, "anInt"); + assertEquals(debug.properties.get(1).type, OType.INTEGER); + assertEquals(debug.properties.get(1).value, 2); + + assertEquals(debug.properties.get(2).name, "anDouble"); + assertEquals(debug.properties.get(2).type, OType.DOUBLE); + assertEquals(debug.properties.get(2).value, 2D); + } finally { + db.drop(); + } + } + + @Test + public void testSchemaFullDocumentDebug() { + ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:" + ORecordSerializerBinaryDebugTest.class.getSimpleName()); + db.create(); + try { + OClass clazz = db.getMetadata().getSchema().createClass("some"); + clazz.createProperty("testP", OType.STRING); + clazz.createProperty("theInt", OType.INTEGER); + ODocument doc = new ODocument("some"); + doc.field("testP", "test"); + doc.field("theInt", 2); + doc.field("anDouble", 2D); + + byte[] bytes = doc.toStream(); + + ORecordSerializerBinaryDebug debugger = new ORecordSerializerBinaryDebug(); + ORecordSerializationDebug debug = debugger.deserializeDebug(bytes, db); + + assertEquals(debug.properties.size(), 3); + assertEquals(debug.properties.get(0).name, "testP"); + assertEquals(debug.properties.get(0).type, OType.STRING); + assertEquals(debug.properties.get(0).value, "test"); + + assertEquals(debug.properties.get(1).name, "theInt"); + assertEquals(debug.properties.get(1).type, OType.INTEGER); + assertEquals(debug.properties.get(1).value, 2); + + assertEquals(debug.properties.get(2).name, "anDouble"); + assertEquals(debug.properties.get(2).type, OType.DOUBLE); + assertEquals(debug.properties.get(2).value, 2D); + } finally { + db.drop(); + } + + } + + @Test + public void testSimpleBrokenDocumentDebug() { + ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:" + ORecordSerializerBinaryDebugTest.class.getSimpleName()); + db.create(); + try { + ODocument doc = new ODocument(); + doc.field("test", "test"); + doc.field("anInt", 2); + doc.field("anDouble", 2D); + + byte[] bytes = doc.toStream(); + byte[] brokenBytes = new byte[bytes.length - 10]; + System.arraycopy(bytes, 0, brokenBytes, 0, bytes.length - 10); + + ORecordSerializerBinaryDebug debugger = new ORecordSerializerBinaryDebug(); + ORecordSerializationDebug debug = debugger.deserializeDebug(brokenBytes, db); + + assertEquals(debug.properties.size(), 3); + assertEquals(debug.properties.get(0).name, "test"); + assertEquals(debug.properties.get(0).type, OType.STRING); + assertEquals(debug.properties.get(0).faildToRead, true); + assertNotNull(debug.properties.get(0).readingException); + + assertEquals(debug.properties.get(1).name, "anInt"); + assertEquals(debug.properties.get(1).type, OType.INTEGER); + assertEquals(debug.properties.get(1).faildToRead, true); + assertNotNull(debug.properties.get(1).readingException); + + assertEquals(debug.properties.get(2).name, "anDouble"); + assertEquals(debug.properties.get(2).type, OType.DOUBLE); + assertEquals(debug.properties.get(2).faildToRead, true); + assertNotNull(debug.properties.get(2).readingException); + } finally { + db.drop(); + } + } + + @Test + public void testBrokenSchemaFullDocumentDebug() { + ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:" + ORecordSerializerBinaryDebugTest.class.getSimpleName()); + db.create(); + try { + OClass clazz = db.getMetadata().getSchema().createClass("some"); + clazz.createProperty("testP", OType.STRING); + clazz.createProperty("theInt", OType.INTEGER); + ODocument doc = new ODocument("some"); + doc.field("testP", "test"); + doc.field("theInt", 2); + doc.field("anDouble", 2D); + + byte[] bytes = doc.toStream(); + byte[] brokenBytes = new byte[bytes.length - 10]; + System.arraycopy(bytes, 0, brokenBytes, 0, bytes.length - 10); + + ORecordSerializerBinaryDebug debugger = new ORecordSerializerBinaryDebug(); + ORecordSerializationDebug debug = debugger.deserializeDebug(brokenBytes, db); + + assertEquals(debug.properties.size(), 3); + assertEquals(debug.properties.get(0).name, "testP"); + assertEquals(debug.properties.get(0).type, OType.STRING); + assertEquals(debug.properties.get(0).faildToRead, true); + assertNotNull(debug.properties.get(0).readingException); + + assertEquals(debug.properties.get(1).name, "theInt"); + assertEquals(debug.properties.get(1).type, OType.INTEGER); + assertEquals(debug.properties.get(1).faildToRead, true); + assertNotNull(debug.properties.get(1).readingException); + + assertEquals(debug.properties.get(2).name, "anDouble"); + assertEquals(debug.properties.get(2).type, OType.DOUBLE); + assertEquals(debug.properties.get(2).faildToRead, true); + assertNotNull(debug.properties.get(2).readingException); + } finally { + db.drop(); + } + + } + +}
b58a646039f2b8830118be3bb6378bf534256291
hbase
HBASE-1816 Master rewrite; should have removed- safe-mode from regionserver-side too -- Needed to remove the wait up in top- of flush and compactions threads-- used to wait on safe mode... was stuck- there...--git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@830844 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/hbase
diff --git a/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java b/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java index 5e0890f1d368..96ec15cd35a8 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java @@ -70,13 +70,6 @@ public CompactSplitThread(HRegionServer server) { @Override public void run() { - while (!this.server.isStopRequested()) { - try { - Thread.sleep(this.frequency); - } catch (InterruptedException ex) { - continue; - } - } int count = 0; while (!this.server.isStopRequested()) { HRegion r = null; diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 5f74b9c9dded..c5855ce46c48 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -202,9 +202,6 @@ public class HRegionServer implements HConstants, HRegionInterface, // eclipse warning when accessed by inner classes protected volatile HLog hlog; LogRoller hlogRoller; - - // limit compactions while starting up - CompactionLimitThread compactionLimitThread; // flag set after we're done setting up server threads (used for testing) protected volatile boolean isOnline; @@ -858,48 +855,6 @@ protected boolean checkFileSystem() { return this.fsOk; } - /** - * Thread that gradually ups compaction limit. - */ - private class CompactionLimitThread extends Thread { - protected CompactionLimitThread() {} - - @Override - public void run() { - // Slowly increase per-cycle compaction limit, finally setting it to - // unlimited (-1) - int compactionCheckInterval = - conf.getInt("hbase.regionserver.thread.splitcompactcheckfrequency", - 20 * 1000); - final int limitSteps[] = { - 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - -1 - }; - for (int i = 0; i < limitSteps.length; i++) { - // Just log changes. - if (compactSplitThread.getLimit() != limitSteps[i] && - LOG.isDebugEnabled()) { - LOG.debug("setting compaction limit to " + limitSteps[i]); - } - compactSplitThread.setLimit(limitSteps[i]); - try { - Thread.sleep(compactionCheckInterval); - } catch (InterruptedException ex) { - // unlimit compactions before exiting - compactSplitThread.setLimit(-1); - if (LOG.isDebugEnabled()) { - LOG.debug(this.getName() + " exiting on interrupt"); - } - return; - } - } - LOG.info("compactions no longer limited"); - } - } - /* * Thread to shutdown the region server in an orderly manner. This thread * is registered as a shutdown hook in the HRegionServer constructor and is @@ -1130,10 +1085,6 @@ public void uncaughtException(Thread t, Throwable e) { } } - this.compactionLimitThread = new CompactionLimitThread(); - Threads.setDaemonThreadRunning(this.compactionLimitThread, n + - ".compactionLimitThread", handler); - // Start Server. This service is like leases in that it internally runs // a thread. this.server.start(); @@ -2083,7 +2034,7 @@ public InfoServer getInfoServer() { * @return true if a stop has been requested. */ public boolean isStopRequested() { - return stopRequested.get(); + return this.stopRequested.get(); } /** diff --git a/src/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java b/src/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java index 9512981e7cff..23aa3096d20d 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java @@ -133,16 +133,9 @@ static long getMemStoreLimit(final long max, final float limit, @Override public void run() { while (!this.server.isStopRequested()) { - try { - Thread.sleep(threadWakeFrequency); - } catch (InterruptedException ex) { - continue; - } - } - while (!server.isStopRequested()) { HRegion r = null; try { - r = flushQueue.poll(threadWakeFrequency, TimeUnit.MILLISECONDS); + r = this.flushQueue.poll(this.threadWakeFrequency, TimeUnit.MILLISECONDS); if (r == null) { continue; } @@ -162,8 +155,8 @@ public void run() { } } } - regionsInQueue.clear(); - flushQueue.clear(); + this.regionsInQueue.clear(); + this.flushQueue.clear(); LOG.info(getName() + " exiting"); } diff --git a/src/test/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java b/src/test/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java index e6294d285df3..880391a5a632 100644 --- a/src/test/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java +++ b/src/test/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java @@ -99,7 +99,6 @@ protected void preHBaseClusterSetup() { private void startAndWriteData() throws Exception { // When the META table can be opened, the region servers are running new HTable(conf, HConstants.META_TABLE_NAME); - this.server = cluster.getRegionThreads().get(0).getRegionServer(); this.log = server.getLog(); @@ -109,15 +108,12 @@ private void startAndWriteData() throws Exception { HBaseAdmin admin = new HBaseAdmin(conf); admin.createTable(desc); HTable table = new HTable(conf, tableName); - for (int i = 1; i <= 256; i++) { // 256 writes should cause 8 log rolls Put put = new Put(Bytes.toBytes("row" + String.format("%1$04d", i))); put.add(HConstants.CATALOG_FAMILY, null, value); table.put(put); - if (i % 32 == 0) { // After every 32 writes sleep to let the log roller run - try { Thread.sleep(2000); } catch (InterruptedException e) { @@ -126,14 +122,14 @@ private void startAndWriteData() throws Exception { } } } - + /** * Tests that logs are deleted * * @throws Exception */ public void testLogRolling() throws Exception { - tableName = getName(); + this.tableName = getName(); try { startAndWriteData(); LOG.info("after writing there are " + log.getNumLogFiles() + " log files"); @@ -158,5 +154,4 @@ public void testLogRolling() throws Exception { throw e; } } - -} +} \ No newline at end of file
387c765e345c46a74a403aa2b8e3b7c634864087
ReactiveX-RxJava
Switch to AtomicIntegerFieldUpdater and volatile- int, instead of AtomicBoolean--
p
https://github.com/ReactiveX/RxJava
diff --git a/rxjava-core/src/main/java/rx/schedulers/CachedThreadScheduler.java b/rxjava-core/src/main/java/rx/schedulers/CachedThreadScheduler.java index 6e71e1f698..2feba948fb 100644 --- a/rxjava-core/src/main/java/rx/schedulers/CachedThreadScheduler.java +++ b/rxjava-core/src/main/java/rx/schedulers/CachedThreadScheduler.java @@ -23,7 +23,7 @@ import java.util.Iterator; import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; /* package */class CachedThreadScheduler extends Scheduler { private static final String WORKER_THREAD_NAME_PREFIX = "RxCachedThreadScheduler-"; @@ -109,7 +109,9 @@ public Worker createWorker() { private static class EventLoopWorker extends Scheduler.Worker { private final CompositeSubscription innerSubscription = new CompositeSubscription(); private final PoolWorker poolWorker; - private final AtomicBoolean releasePoolWorkerOnce = new AtomicBoolean(false); + volatile int once; + static final AtomicIntegerFieldUpdater<EventLoopWorker> ONCE_UPDATER + = AtomicIntegerFieldUpdater.newUpdater(EventLoopWorker.class, "once"); EventLoopWorker(PoolWorker poolWorker) { this.poolWorker = poolWorker; @@ -117,7 +119,7 @@ private static class EventLoopWorker extends Scheduler.Worker { @Override public void unsubscribe() { - if (releasePoolWorkerOnce.compareAndSet(false, true)) { + if (ONCE_UPDATER.compareAndSet(this, 0, 1)) { // unsubscribe should be idempotent, so only do this once CachedWorkerPool.INSTANCE.release(poolWorker); }
e2c0cf69ca83483c0128021a78fd82e6b5745b01
hadoop
svn merge -c 1420232 FIXES: YARN-266. RM and JHS- Web UIs are blank because AppsBlock is not escaping string properly.- Contributed by Ravi Prakash--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1420233 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/hadoop
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java index 95715c7b74c20..f9048c0a4ea56 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java @@ -78,12 +78,12 @@ public class HsJobsBlock extends HtmlBlock { .append(dateFormat.format(new Date(job.getFinishTime()))).append("\",\"") .append("<a href='").append(url("job", job.getId())).append("'>") .append(job.getId()).append("</a>\",\"") - .append(StringEscapeUtils.escapeHtml(job.getName())) - .append("\",\"") - .append(StringEscapeUtils.escapeHtml(job.getUserName())) - .append("\",\"") - .append(StringEscapeUtils.escapeHtml(job.getQueueName())) - .append("\",\"") + .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml( + job.getName()))).append("\",\"") + .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml( + job.getUserName()))).append("\",\"") + .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml( + job.getQueueName()))).append("\",\"") .append(job.getState()).append("\",\"") .append(String.valueOf(job.getMapsTotal())).append("\",\"") .append(String.valueOf(job.getMapsCompleted())).append("\",\"") diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 778c807a53dd1..03b08bbe2db24 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -189,6 +189,9 @@ Release 0.23.6 - UNRELEASED YARN-258. RM web page UI shows Invalid Date for start and finish times (Ravi Prakash via jlowe) + YARN-266. RM and JHS Web UIs are blank because AppsBlock is not escaping + string properly (Ravi Prakash via jlowe) + Release 0.23.5 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java index e90edae89aaa9..6fd35ec12b859 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java @@ -84,12 +84,12 @@ class AppsBlock extends HtmlBlock { appsTableData.append("[\"<a href='") .append(url("app", appInfo.getAppId())).append("'>") .append(appInfo.getAppId()).append("</a>\",\"") - .append(StringEscapeUtils.escapeHtml(appInfo.getUser())) - .append("\",\"") - .append(StringEscapeUtils.escapeHtml(appInfo.getName())) - .append("\",\"") - .append(StringEscapeUtils.escapeHtml(appInfo.getQueue())) - .append("\",\"") + .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml( + appInfo.getUser()))).append("\",\"") + .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml( + appInfo.getName()))).append("\",\"") + .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml( + appInfo.getQueue()))).append("\",\"") .append(appInfo.getStartTime()).append("\",\"") .append(appInfo.getFinishTime()).append("\",\"") .append(appInfo.getState()).append("\",\"")
41babf3a10b9d1c0ad9dcf33b39261a96097a4a8
intellij-community
title changed--
p
https://github.com/JetBrains/intellij-community
diff --git a/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleFromSelectedFragment.java b/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleFromSelectedFragment.java index ad9f0c607b24a..b36e520b783e0 100644 --- a/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleFromSelectedFragment.java +++ b/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleFromSelectedFragment.java @@ -92,7 +92,7 @@ public FragmentCodeStyleSettingsDialog(@NotNull Project project, @NotNull Editor myTabbedLanguagePanel = new CodeFragmentCodeStyleSettingsPanel(settings, project, editor, file); - setTitle("Configure Code Style Settings on Selected Fragment"); + setTitle("Configure Code Style Settings: " + file.getLanguage().getDisplayName()); setOKButtonText("Save"); init(); }
d4bc187be90fb4bf65bde43d6166073429041749
elasticsearch
rename node to DiscoveryNode--
p
https://github.com/elastic/elasticsearch
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java index 88480851d0bdc..a942fced4d2f6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java @@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableMap; import org.elasticsearch.action.support.nodes.NodeOperationResponse; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.io.stream.StreamInput; import org.elasticsearch.util.io.stream.StreamOutput; import org.elasticsearch.util.settings.ImmutableSettings; @@ -42,11 +42,11 @@ public class NodeInfo extends NodeOperationResponse { NodeInfo() { } - public NodeInfo(Node node, Map<String, String> attributes, Settings settings) { + public NodeInfo(DiscoveryNode node, Map<String, String> attributes, Settings settings) { this(node, ImmutableMap.copyOf(attributes), settings); } - public NodeInfo(Node node, ImmutableMap<String, String> attributes, Settings settings) { + public NodeInfo(DiscoveryNode node, ImmutableMap<String, String> attributes, Settings settings) { super(node); this.attributes = attributes; this.settings = settings; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java index 9b6104df3fe84..4c887230a8891 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java @@ -22,7 +22,7 @@ import org.elasticsearch.action.support.nodes.NodeOperationResponse; import org.elasticsearch.action.support.nodes.NodesOperationResponse; import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.io.stream.StreamInput; import org.elasticsearch.util.io.stream.StreamOutput; @@ -61,7 +61,7 @@ public static class NodeShutdownResponse extends NodeOperationResponse { NodeShutdownResponse() { } - public NodeShutdownResponse(Node node) { + public NodeShutdownResponse(DiscoveryNode node) { super(node); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryAndFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryAndFetchAction.java index a29f247815614..4f46b1e1c382d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryAndFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryAndFetchAction.java @@ -23,7 +23,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.search.SearchShardTarget; @@ -74,7 +74,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen return "dfs"; } - @Override protected void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener<DfsSearchResult> listener) { + @Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<DfsSearchResult> listener) { searchService.sendExecuteDfs(node, request, listener); } @@ -88,7 +88,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen int localOperations = 0; for (DfsSearchResult dfsResult : dfsResults) { - Node node = nodes.get(dfsResult.shardTarget().nodeId()); + DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { localOperations++; } else { @@ -101,7 +101,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen threadPool.execute(new Runnable() { @Override public void run() { for (DfsSearchResult dfsResult : dfsResults) { - Node node = nodes.get(dfsResult.shardTarget().nodeId()); + DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { QuerySearchRequest querySearchRequest = new QuerySearchRequest(dfsResult.id(), dfs); executeSecondPhase(counter, node, querySearchRequest); @@ -112,7 +112,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (DfsSearchResult dfsResult : dfsResults) { - final Node node = nodes.get(dfsResult.shardTarget().nodeId()); + final DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { final QuerySearchRequest querySearchRequest = new QuerySearchRequest(dfsResult.id(), dfs); if (localAsync) { @@ -130,7 +130,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen } } - private void executeSecondPhase(final AtomicInteger counter, Node node, QuerySearchRequest querySearchRequest) { + private void executeSecondPhase(final AtomicInteger counter, DiscoveryNode node, QuerySearchRequest querySearchRequest) { searchService.sendExecuteFetch(node, querySearchRequest, new SearchServiceListener<QueryFetchSearchResult>() { @Override public void onResult(QueryFetchSearchResult result) { queryFetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java index 13581b8ed75d2..b282333958171 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java @@ -23,7 +23,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.search.SearchShardTarget; @@ -78,7 +78,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen return "dfs"; } - @Override protected void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener<DfsSearchResult> listener) { + @Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<DfsSearchResult> listener) { searchService.sendExecuteDfs(node, request, listener); } @@ -93,7 +93,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen int localOperations = 0; for (DfsSearchResult dfsResult : dfsResults) { - Node node = nodes.get(dfsResult.shardTarget().nodeId()); + DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { localOperations++; } else { @@ -107,7 +107,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen threadPool.execute(new Runnable() { @Override public void run() { for (DfsSearchResult dfsResult : dfsResults) { - Node node = nodes.get(dfsResult.shardTarget().nodeId()); + DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { QuerySearchRequest querySearchRequest = new QuerySearchRequest(dfsResult.id(), dfs); executeQuery(counter, querySearchRequest, node); @@ -118,7 +118,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (DfsSearchResult dfsResult : dfsResults) { - final Node node = nodes.get(dfsResult.shardTarget().nodeId()); + final DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { final QuerySearchRequest querySearchRequest = new QuerySearchRequest(dfsResult.id(), dfs); if (localAsync) { @@ -136,7 +136,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen } } - private void executeQuery(final AtomicInteger counter, QuerySearchRequest querySearchRequest, Node node) { + private void executeQuery(final AtomicInteger counter, QuerySearchRequest querySearchRequest, DiscoveryNode node) { searchService.sendExecuteQuery(node, querySearchRequest, new SearchServiceListener<QuerySearchResult>() { @Override public void onResult(QuerySearchResult result) { queryResults.put(result.shardTarget(), result); @@ -178,7 +178,7 @@ private void innerExecuteFetchPhase() { final AtomicInteger counter = new AtomicInteger(docIdsToLoad.size()); int localOperations = 0; for (Map.Entry<SearchShardTarget, ExtTIntArrayList> entry : docIdsToLoad.entrySet()) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { localOperations++; } else { @@ -192,7 +192,7 @@ private void innerExecuteFetchPhase() { threadPool.execute(new Runnable() { @Override public void run() { for (Map.Entry<SearchShardTarget, ExtTIntArrayList> entry : docIdsToLoad.entrySet()) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(entry.getKey()).id(), entry.getValue()); executeFetch(counter, fetchSearchRequest, node); @@ -203,7 +203,7 @@ private void innerExecuteFetchPhase() { } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (Map.Entry<SearchShardTarget, ExtTIntArrayList> entry : docIdsToLoad.entrySet()) { - final Node node = nodes.get(entry.getKey().nodeId()); + final DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { final FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(entry.getKey()).id(), entry.getValue()); if (localAsync) { @@ -223,7 +223,7 @@ private void innerExecuteFetchPhase() { releaseIrrelevantSearchContexts(queryResults, docIdsToLoad); } - private void executeFetch(final AtomicInteger counter, FetchSearchRequest fetchSearchRequest, Node node) { + private void executeFetch(final AtomicInteger counter, FetchSearchRequest fetchSearchRequest, DiscoveryNode node) { searchService.sendExecuteFetch(node, fetchSearchRequest, new SearchServiceListener<FetchSearchResult>() { @Override public void onResult(FetchSearchResult result) { fetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java index 37818542ca7cd..3c4682b68a573 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.search.SearchShardTarget; @@ -68,7 +68,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen return "query_fetch"; } - @Override protected void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener<QueryFetchSearchResult> listener) { + @Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<QueryFetchSearchResult> listener) { searchService.sendExecuteFetch(node, request, listener); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java index adcc6f5b5b150..ef82fa0cc43f9 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java @@ -23,7 +23,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.search.SearchShardTarget; @@ -72,7 +72,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen return "query"; } - @Override protected void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener<QuerySearchResult> listener) { + @Override protected void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<QuerySearchResult> listener) { searchService.sendExecuteQuery(node, request, listener); } @@ -93,7 +93,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen int localOperations = 0; for (Map.Entry<SearchShardTarget, ExtTIntArrayList> entry : docIdsToLoad.entrySet()) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { localOperations++; } else { @@ -107,7 +107,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen threadPool.execute(new Runnable() { @Override public void run() { for (Map.Entry<SearchShardTarget, ExtTIntArrayList> entry : docIdsToLoad.entrySet()) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(entry.getKey()).id(), entry.getValue()); executeFetch(counter, fetchSearchRequest, node); @@ -118,7 +118,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (Map.Entry<SearchShardTarget, ExtTIntArrayList> entry : docIdsToLoad.entrySet()) { - final Node node = nodes.get(entry.getKey().nodeId()); + final DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { final FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(entry.getKey()).id(), entry.getValue()); if (localAsync) { @@ -138,7 +138,7 @@ private AsyncAction(SearchRequest request, ActionListener<SearchResponse> listen releaseIrrelevantSearchContexts(queryResults, docIdsToLoad); } - private void executeFetch(final AtomicInteger counter, FetchSearchRequest fetchSearchRequest, Node node) { + private void executeFetch(final AtomicInteger counter, FetchSearchRequest fetchSearchRequest, DiscoveryNode node) { searchService.sendExecuteFetch(node, fetchSearchRequest, new SearchServiceListener<FetchSearchResult>() { @Override public void onResult(FetchSearchResult result) { fetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java index 9d2f0eddbac62..5ccde73ec9f8a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java @@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.action.SearchServiceListener; import org.elasticsearch.search.action.SearchServiceTransportAction; @@ -81,7 +81,7 @@ private class AsyncAction { private final ParsedScrollId scrollId; - private final Nodes nodes; + private final DiscoveryNodes nodes; protected final Collection<ShardSearchFailure> shardFailures = searchCache.obtainShardFailures(); @@ -107,7 +107,7 @@ public void start() { int localOperations = 0; for (Tuple<String, Long> target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node != null) { if (nodes.localNodeId().equals(node.id())) { localOperations++; @@ -130,7 +130,7 @@ public void start() { threadPool.execute(new Runnable() { @Override public void run() { for (Tuple<String, Long> target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { executePhase(node, target.v2()); } @@ -140,7 +140,7 @@ public void start() { } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Tuple<String, Long> target : scrollId.values()) { - final Node node = nodes.get(target.v1()); + final DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { if (localAsync) { threadPool.execute(new Runnable() { @@ -157,7 +157,7 @@ public void start() { } for (Tuple<String, Long> target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node == null) { if (logger.isDebugEnabled()) { logger.debug("Node [" + target.v1() + "] not available for scroll request [" + scrollId.source() + "]"); @@ -171,7 +171,7 @@ public void start() { } } - private void executePhase(Node node, long searchId) { + private void executePhase(DiscoveryNode node, long searchId) { searchService.sendExecuteFetch(node, internalScrollSearchRequest(searchId, request), new SearchServiceListener<QueryFetchSearchResult>() { @Override public void onResult(QueryFetchSearchResult result) { queryFetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java index a146019e986ab..a2f1a00eb04b1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java @@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.action.SearchServiceListener; import org.elasticsearch.search.action.SearchServiceTransportAction; @@ -85,7 +85,7 @@ private class AsyncAction { private final ParsedScrollId scrollId; - private final Nodes nodes; + private final DiscoveryNodes nodes; protected final Collection<ShardSearchFailure> shardFailures = searchCache.obtainShardFailures(); @@ -113,7 +113,7 @@ public void start() { int localOperations = 0; for (Tuple<String, Long> target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node != null) { if (nodes.localNodeId().equals(node.id())) { localOperations++; @@ -136,7 +136,7 @@ public void start() { threadPool.execute(new Runnable() { @Override public void run() { for (Tuple<String, Long> target : scrollId.values()) { - Node node = nodes.get(target.v1()); + DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { executeQueryPhase(counter, node, target.v2()); } @@ -146,7 +146,7 @@ public void start() { } else { boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Tuple<String, Long> target : scrollId.values()) { - final Node node = nodes.get(target.v1()); + final DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { if (localAsync) { threadPool.execute(new Runnable() { @@ -163,7 +163,7 @@ public void start() { } } - private void executeQueryPhase(final AtomicInteger counter, Node node, long searchId) { + private void executeQueryPhase(final AtomicInteger counter, DiscoveryNode node, long searchId) { searchService.sendExecuteQuery(node, internalScrollSearchRequest(searchId, request), new SearchServiceListener<QuerySearchResult>() { @Override public void onResult(QuerySearchResult result) { queryResults.put(result.shardTarget(), result); @@ -199,7 +199,7 @@ private void executeFetchPhase() { SearchShardTarget shardTarget = entry.getKey(); ExtTIntArrayList docIds = entry.getValue(); FetchSearchRequest fetchSearchRequest = new FetchSearchRequest(queryResults.get(shardTarget).id(), docIds); - Node node = nodes.get(shardTarget.nodeId()); + DiscoveryNode node = nodes.get(shardTarget.nodeId()); searchService.sendExecuteFetch(node, fetchSearchRequest, new SearchServiceListener<FetchSearchResult>() { @Override public void onResult(FetchSearchResult result) { fetchResults.put(result.shardTarget(), result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java index 5e0ca3d3b8a6d..b186a9e9b5aff 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java @@ -24,8 +24,8 @@ import org.elasticsearch.action.support.BaseAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; @@ -83,7 +83,7 @@ protected abstract class BaseAsyncAction<FirstResult> { protected final SearchRequest request; - protected final Nodes nodes; + protected final DiscoveryNodes nodes; protected final int expectedSuccessfulOps; @@ -172,7 +172,7 @@ private void performFirstPhase(final ShardsIterator shardIt) { // no more active shards... (we should not really get here, but just for safety) onFirstPhaseResult(shard, shardIt, null); } else { - Node node = nodes.get(shard.currentNodeId()); + DiscoveryNode node = nodes.get(shard.currentNodeId()); sendExecuteFirstPhase(node, internalSearchRequest(shard, request), new SearchServiceListener<FirstResult>() { @Override public void onResult(FirstResult result) { onFirstPhaseResult(shard, result, shardIt); @@ -281,7 +281,7 @@ protected void releaseIrrelevantSearchContexts(Map<SearchShardTarget, QuerySearc Map<SearchShardTarget, ExtTIntArrayList> docIdsToLoad) { for (Map.Entry<SearchShardTarget, QuerySearchResultProvider> entry : queryResults.entrySet()) { if (!docIdsToLoad.containsKey(entry.getKey())) { - Node node = nodes.get(entry.getKey().nodeId()); + DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node != null) { // should not happen (==null) but safeguard anyhow searchService.sendFreeContext(node, entry.getValue().id()); } @@ -313,7 +313,7 @@ protected void invokeListener(final Throwable t) { } } - protected abstract void sendExecuteFirstPhase(Node node, InternalSearchRequest request, SearchServiceListener<FirstResult> listener); + protected abstract void sendExecuteFirstPhase(DiscoveryNode node, InternalSearchRequest request, SearchServiceListener<FirstResult> listener); protected abstract void processFirstPhaseResult(ShardRouting shard, FirstResult result); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java index 585a8270ffdb3..ed26cca460e87 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java @@ -25,8 +25,8 @@ import org.elasticsearch.action.support.BaseAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; @@ -111,7 +111,7 @@ class AsyncBroadcastAction { private final ClusterState clusterState; - private final Nodes nodes; + private final DiscoveryNodes nodes; private final GroupShardsIterator shardsIts; @@ -216,7 +216,7 @@ private void performOperation(final ShardsIterator shardIt, boolean localAsync) } } } else { - Node node = nodes.get(shard.currentNodeId()); + DiscoveryNode node = nodes.get(shard.currentNodeId()); transportService.sendRequest(node, transportShardAction(), shardRequest, new BaseTransportResponseHandler<ShardResponse>() { @Override public ShardResponse newInstance() { return newShardResponse(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java index 5d0679817754b..8928a5b6ac675 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.support.BaseAction; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.settings.Settings; @@ -60,7 +60,7 @@ protected TransportMasterNodeOperationAction(Settings settings, TransportService protected abstract Response masterOperation(Request request) throws ElasticSearchException; @Override protected void doExecute(final Request request, final ActionListener<Response> listener) { - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java index 6e15509d5614d..cd58ba28adcdf 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java @@ -19,7 +19,7 @@ package org.elasticsearch.action.support.nodes; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.io.stream.StreamInput; import org.elasticsearch.util.io.stream.StreamOutput; import org.elasticsearch.util.io.stream.Streamable; @@ -31,21 +31,21 @@ */ public abstract class NodeOperationResponse implements Streamable { - private Node node; + private DiscoveryNode node; protected NodeOperationResponse() { } - protected NodeOperationResponse(Node node) { + protected NodeOperationResponse(DiscoveryNode node) { this.node = node; } - public Node node() { + public DiscoveryNode node() { return node; } @Override public void readFrom(StreamInput in) throws IOException { - node = Node.readNode(in); + node = DiscoveryNode.readNode(in); } @Override public void writeTo(StreamOutput out) throws IOException { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java index 459a8a02e89f1..1406bc171da69 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.settings.Settings; @@ -108,7 +108,7 @@ private AsyncAction(Request request, ActionListener<Response> listener) { if (nodesIds == null || nodesIds.length == 0 || (nodesIds.length == 1 && nodesIds[0].equals("_all"))) { int index = 0; nodesIds = new String[clusterState.nodes().size()]; - for (Node node : clusterState.nodes()) { + for (DiscoveryNode node : clusterState.nodes()) { nodesIds[index++] = node.id(); } } @@ -118,7 +118,7 @@ private AsyncAction(Request request, ActionListener<Response> listener) { private void start() { for (final String nodeId : nodesIds) { - final Node node = clusterState.nodes().nodes().get(nodeId); + final DiscoveryNode node = clusterState.nodes().nodes().get(nodeId); if (nodeId.equals("_local") || nodeId.equals(clusterState.nodes().localNodeId())) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java index 687af98b45983..307c55ba8d373 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java @@ -29,8 +29,8 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.TimeoutClusterStateListener; import org.elasticsearch.cluster.action.shard.ShardStateAction; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; import org.elasticsearch.index.IndexShardMissingException; @@ -201,7 +201,7 @@ private class AsyncShardOperationAction { private final Request request; - private Nodes nodes; + private DiscoveryNodes nodes; private ShardsIterator shards; @@ -255,7 +255,7 @@ public boolean start(final boolean fromClusterEvent) throws ElasticSearchExcepti performOnPrimary(shard.id(), fromClusterEvent, false, shard); } } else { - Node node = nodes.get(shard.currentNodeId()); + DiscoveryNode node = nodes.get(shard.currentNodeId()); transportService.sendRequest(node, transportAction(), request, new BaseTransportResponseHandler<Response>() { @Override public Response newInstance() { @@ -399,7 +399,7 @@ private void performBackups(final Response response, boolean alreadyThreaded) { private void performOnBackup(final Response response, final AtomicInteger counter, final ShardRouting shard, String nodeId) { final ShardOperationRequest shardRequest = new ShardOperationRequest(shards.shardId().id(), request); if (!nodeId.equals(nodes.localNodeId())) { - Node node = nodes.get(nodeId); + DiscoveryNode node = nodes.get(nodeId); transportService.sendRequest(node, transportBackupAction(), shardRequest, new VoidTransportResponseHandler() { @Override public void handleResponse(VoidStreamable vResponse) { finishIfPossible(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/TransportSingleOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/TransportSingleOperationAction.java index c9299800119a5..2f658c1057a72 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/TransportSingleOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/TransportSingleOperationAction.java @@ -26,8 +26,8 @@ import org.elasticsearch.action.support.BaseAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; import org.elasticsearch.indices.IndicesService; @@ -86,7 +86,7 @@ private class AsyncSingleAction { private final Request request; - private final Nodes nodes; + private final DiscoveryNodes nodes; private AsyncSingleAction(Request request, ActionListener<Response> listener) { this.request = request; @@ -164,7 +164,7 @@ private void perform(final Exception lastException) { final ShardRouting shard = shardsIt.nextActive(); // no need to check for local nodes, we tried them already in performFirstGet if (!shard.currentNodeId().equals(nodes.localNodeId())) { - Node node = nodes.get(shard.currentNodeId()); + DiscoveryNode node = nodes.get(shard.currentNodeId()); transportService.sendRequest(node, transportShardAction(), new ShardSingleOperationRequest(request, shard.id()), new BaseTransportResponseHandler<Response>() { @Override public Response newInstance() { return newResponse(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java index 4d46c434dd2b3..c9761b7179f9e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java @@ -47,7 +47,7 @@ import org.elasticsearch.client.transport.action.ClientTransportActionModule; import org.elasticsearch.client.transport.support.InternalTransportClient; import org.elasticsearch.cluster.ClusterNameModule; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.env.Environment; import org.elasticsearch.env.EnvironmentModule; import org.elasticsearch.server.internal.InternalSettingsPerparer; @@ -166,7 +166,7 @@ public ImmutableList<TransportAddress> transportAddresses() { * <p>The nodes include all the nodes that are currently alive based on the transport * addresses provided. */ - public ImmutableList<Node> connectedNodes() { + public ImmutableList<DiscoveryNode> connectedNodes() { return nodesService.connectedNodes(); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java index 2e202c239af3a..de32ec5ca6c4b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java @@ -28,8 +28,8 @@ import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterStateListener; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportResponseHandler; import org.elasticsearch.transport.ConnectTransportException; @@ -65,9 +65,9 @@ public class TransportClientNodesService extends AbstractComponent implements Cl private final Object transportMutex = new Object(); - private volatile ImmutableList<Node> nodes = ImmutableList.of(); + private volatile ImmutableList<DiscoveryNode> nodes = ImmutableList.of(); - private volatile Nodes discoveredNodes; + private volatile DiscoveryNodes discoveredNodes; private final AtomicInteger tempNodeIdGenerator = new AtomicInteger(); @@ -100,7 +100,7 @@ public ImmutableList<TransportAddress> transportAddresses() { return this.transportAddresses; } - public ImmutableList<Node> connectedNodes() { + public ImmutableList<DiscoveryNode> connectedNodes() { return this.nodes; } @@ -128,13 +128,13 @@ public TransportClientNodesService removeTransportAddress(TransportAddress trans } public <T> T execute(NodeCallback<T> callback) throws ElasticSearchException { - ImmutableList<Node> nodes = this.nodes; + ImmutableList<DiscoveryNode> nodes = this.nodes; if (nodes.isEmpty()) { throw new NoNodeAvailableException(); } int index = randomNodeGenerator.incrementAndGet(); for (int i = 0; i < nodes.size(); i++) { - Node node = nodes.get((index + i) % nodes.size()); + DiscoveryNode node = nodes.get((index + i) % nodes.size()); try { return callback.doWithNode(node); } catch (ConnectTransportException e) { @@ -151,9 +151,9 @@ public void close() { @Override public void clusterChanged(ClusterChangedEvent event) { transportService.nodesAdded(event.nodesDelta().addedNodes()); this.discoveredNodes = event.state().nodes(); - HashSet<Node> newNodes = new HashSet<Node>(nodes); + HashSet<DiscoveryNode> newNodes = new HashSet<DiscoveryNode>(nodes); newNodes.addAll(discoveredNodes.nodes().values()); - nodes = new ImmutableList.Builder<Node>().addAll(newNodes).build(); + nodes = new ImmutableList.Builder<DiscoveryNode>().addAll(newNodes).build(); transportService.nodesRemoved(event.nodesDelta().removedNodes()); } @@ -163,11 +163,11 @@ private class ScheduledNodesSampler implements Runnable { ImmutableList<TransportAddress> transportAddresses = TransportClientNodesService.this.transportAddresses; final CountDownLatch latch = new CountDownLatch(transportAddresses.size()); final CopyOnWriteArrayList<NodesInfoResponse> nodesInfoResponses = new CopyOnWriteArrayList<NodesInfoResponse>(); - final CopyOnWriteArrayList<Node> tempNodes = new CopyOnWriteArrayList<Node>(); + final CopyOnWriteArrayList<DiscoveryNode> tempNodes = new CopyOnWriteArrayList<DiscoveryNode>(); for (final TransportAddress transportAddress : transportAddresses) { threadPool.execute(new Runnable() { @Override public void run() { - Node tempNode = new Node("#temp#-" + tempNodeIdGenerator.incrementAndGet(), transportAddress); + DiscoveryNode tempNode = new DiscoveryNode("#temp#-" + tempNodeIdGenerator.incrementAndGet(), transportAddress); tempNodes.add(tempNode); try { transportService.nodesAdded(ImmutableList.of(tempNode)); @@ -201,10 +201,10 @@ private class ScheduledNodesSampler implements Runnable { return; } - HashSet<Node> newNodes = new HashSet<Node>(); + HashSet<DiscoveryNode> newNodes = new HashSet<DiscoveryNode>(); for (NodesInfoResponse nodesInfoResponse : nodesInfoResponses) { if (nodesInfoResponse.nodes().length > 0) { - Node node = nodesInfoResponse.nodes()[0].node(); + DiscoveryNode node = nodesInfoResponse.nodes()[0].node(); if (!clusterName.equals(nodesInfoResponse.clusterName())) { logger.warn("Node {} not part of the cluster {}, ignoring...", node, clusterName); } else { @@ -218,7 +218,7 @@ private class ScheduledNodesSampler implements Runnable { if (discoveredNodes != null) { newNodes.addAll(discoveredNodes.nodes().values()); } - nodes = new ImmutableList.Builder<Node>().addAll(newNodes).build(); + nodes = new ImmutableList.Builder<DiscoveryNode>().addAll(newNodes).build(); transportService.nodesRemoved(tempNodes); } @@ -226,6 +226,6 @@ private class ScheduledNodesSampler implements Runnable { public static interface NodeCallback<T> { - T doWithNode(Node node) throws ElasticSearchException; + T doWithNode(DiscoveryNode node) throws ElasticSearchException; } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportAction.java index 1fcd4a5145664..cb227b4ffce63 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/ClientTransportAction.java @@ -24,14 +24,14 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; /** * @author kimchy (Shay Banon) */ public interface ClientTransportAction<Request extends ActionRequest, Response extends ActionResponse> { - ActionFuture<Response> execute(Node node, Request request) throws ElasticSearchException; + ActionFuture<Response> execute(DiscoveryNode node, Request request) throws ElasticSearchException; - void execute(Node node, Request request, ActionListener<Response> listener); + void execute(DiscoveryNode node, Request request, ActionListener<Response> listener); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/support/BaseClientTransportAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/support/BaseClientTransportAction.java index f0d2d5378717d..36c4a853e0c76 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/support/BaseClientTransportAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/action/support/BaseClientTransportAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.client.transport.action.ClientTransportAction; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.transport.BaseTransportResponseHandler; import org.elasticsearch.transport.RemoteTransportException; import org.elasticsearch.transport.TransportService; @@ -59,14 +59,14 @@ protected BaseClientTransportAction(Settings settings, TransportService transpor responseConstructor.setAccessible(true); } - @Override public ActionFuture<Response> execute(Node node, Request request) throws ElasticSearchException { + @Override public ActionFuture<Response> execute(DiscoveryNode node, Request request) throws ElasticSearchException { PlainActionFuture<Response> future = newFuture(); request.listenerThreaded(false); execute(node, request, future); return future; } - @Override public void execute(Node node, final Request request, final ActionListener<Response> listener) { + @Override public void execute(DiscoveryNode node, final Request request, final ActionListener<Response> listener) { transportService.sendRequest(node, action(), request, new BaseTransportResponseHandler<Response>() { @Override public Response newInstance() { return BaseClientTransportAction.this.newInstance(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClient.java index 03ef658e0c024..9e9a7fc905233 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClient.java @@ -51,7 +51,7 @@ import org.elasticsearch.client.transport.action.search.ClientTransportSearchAction; import org.elasticsearch.client.transport.action.search.ClientTransportSearchScrollAction; import org.elasticsearch.client.transport.action.terms.ClientTransportTermsAction; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.component.AbstractComponent; import org.elasticsearch.util.settings.Settings; @@ -112,7 +112,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<IndexResponse> index(final IndexRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndexResponse>>() { - @Override public ActionFuture<IndexResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<IndexResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return indexAction.execute(node, request); } }); @@ -120,7 +120,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void index(final IndexRequest request, final ActionListener<IndexResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { indexAction.execute(node, request, listener); return null; } @@ -129,7 +129,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<DeleteResponse> delete(final DeleteRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteResponse>>() { - @Override public ActionFuture<DeleteResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<DeleteResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return deleteAction.execute(node, request); } }); @@ -137,7 +137,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void delete(final DeleteRequest request, final ActionListener<DeleteResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { deleteAction.execute(node, request, listener); return null; } @@ -146,7 +146,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<DeleteByQueryResponse> deleteByQuery(final DeleteByQueryRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteByQueryResponse>>() { - @Override public ActionFuture<DeleteByQueryResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<DeleteByQueryResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return deleteByQueryAction.execute(node, request); } }); @@ -154,7 +154,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void deleteByQuery(final DeleteByQueryRequest request, final ActionListener<DeleteByQueryResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { deleteByQueryAction.execute(node, request, listener); return null; } @@ -163,7 +163,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<GetResponse> get(final GetRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<GetResponse>>() { - @Override public ActionFuture<GetResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<GetResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return getAction.execute(node, request); } }); @@ -171,7 +171,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void get(final GetRequest request, final ActionListener<GetResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { getAction.execute(node, request, listener); return null; } @@ -180,7 +180,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<CountResponse> count(final CountRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<CountResponse>>() { - @Override public ActionFuture<CountResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<CountResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return countAction.execute(node, request); } }); @@ -188,7 +188,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void count(final CountRequest request, final ActionListener<CountResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { countAction.execute(node, request, listener); return null; } @@ -197,7 +197,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<SearchResponse> search(final SearchRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() { - @Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<SearchResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return searchAction.execute(node, request); } }); @@ -205,7 +205,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void search(final SearchRequest request, final ActionListener<SearchResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { searchAction.execute(node, request, listener); return null; } @@ -214,7 +214,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<SearchResponse> searchScroll(final SearchScrollRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() { - @Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<SearchResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return searchScrollAction.execute(node, request); } }); @@ -222,7 +222,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void searchScroll(final SearchScrollRequest request, final ActionListener<SearchResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { searchScrollAction.execute(node, request, listener); return null; } @@ -231,7 +231,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<TermsResponse> terms(final TermsRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<TermsResponse>>() { - @Override public ActionFuture<TermsResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<TermsResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return termsAction.execute(node, request); } }); @@ -239,7 +239,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void terms(final TermsRequest request, final ActionListener<TermsResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<Void>>() { - @Override public ActionFuture<Void> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<Void> doWithNode(DiscoveryNode node) throws ElasticSearchException { termsAction.execute(node, request, listener); return null; } @@ -248,7 +248,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public ActionFuture<SearchResponse> moreLikeThis(final MoreLikeThisRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SearchResponse>>() { - @Override public ActionFuture<SearchResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<SearchResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return moreLikeThisAction.execute(node, request); } }); @@ -256,7 +256,7 @@ public class InternalTransportClient extends AbstractComponent implements Client @Override public void moreLikeThis(final MoreLikeThisRequest request, final ActionListener<SearchResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { moreLikeThisAction.execute(node, request, listener); return null; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClusterAdminClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClusterAdminClient.java index 0420e6b47f05d..7fa4dbcb7837b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClusterAdminClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportClusterAdminClient.java @@ -46,7 +46,7 @@ import org.elasticsearch.client.transport.action.admin.cluster.ping.replication.ClientTransportReplicationPingAction; import org.elasticsearch.client.transport.action.admin.cluster.ping.single.ClientTransportSinglePingAction; import org.elasticsearch.client.transport.action.admin.cluster.state.ClientTransportClusterStateAction; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.component.AbstractComponent; import org.elasticsearch.util.settings.Settings; @@ -88,7 +88,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture<ClusterHealthResponse> health(final ClusterHealthRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClusterHealthResponse>>() { - @Override public ActionFuture<ClusterHealthResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<ClusterHealthResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return clusterHealthAction.execute(node, request); } }); @@ -96,7 +96,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void health(final ClusterHealthRequest request, final ActionListener<ClusterHealthResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { clusterHealthAction.execute(node, request, listener); return null; } @@ -105,7 +105,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture<ClusterStateResponse> state(final ClusterStateRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClusterStateResponse>>() { - @Override public ActionFuture<ClusterStateResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<ClusterStateResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return clusterStateAction.execute(node, request); } }); @@ -113,7 +113,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void state(final ClusterStateRequest request, final ActionListener<ClusterStateResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { clusterStateAction.execute(node, request, listener); return null; } @@ -122,7 +122,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture<SinglePingResponse> ping(final SinglePingRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<SinglePingResponse>>() { - @Override public ActionFuture<SinglePingResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<SinglePingResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return singlePingAction.execute(node, request); } }); @@ -130,7 +130,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void ping(final SinglePingRequest request, final ActionListener<SinglePingResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { singlePingAction.execute(node, request, listener); return null; } @@ -139,7 +139,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture<BroadcastPingResponse> ping(final BroadcastPingRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<BroadcastPingResponse>>() { - @Override public ActionFuture<BroadcastPingResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<BroadcastPingResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return broadcastPingAction.execute(node, request); } }); @@ -147,7 +147,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void ping(final BroadcastPingRequest request, final ActionListener<BroadcastPingResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { broadcastPingAction.execute(node, request, listener); return null; } @@ -156,7 +156,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture<ReplicationPingResponse> ping(final ReplicationPingRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ReplicationPingResponse>>() { - @Override public ActionFuture<ReplicationPingResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<ReplicationPingResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return replicationPingAction.execute(node, request); } }); @@ -164,7 +164,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void ping(final ReplicationPingRequest request, final ActionListener<ReplicationPingResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { replicationPingAction.execute(node, request, listener); return null; } @@ -173,7 +173,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture<NodesInfoResponse> nodesInfo(final NodesInfoRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<NodesInfoResponse>>() { - @Override public ActionFuture<NodesInfoResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<NodesInfoResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return nodesInfoAction.execute(node, request); } }); @@ -181,7 +181,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void nodesInfo(final NodesInfoRequest request, final ActionListener<NodesInfoResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { nodesInfoAction.execute(node, request, listener); return null; } @@ -190,7 +190,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public ActionFuture<NodesShutdownResponse> nodesShutdown(final NodesShutdownRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<NodesShutdownResponse>>() { - @Override public ActionFuture<NodesShutdownResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<NodesShutdownResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return nodesShutdownAction.execute(node, request); } }); @@ -198,7 +198,7 @@ public class InternalTransportClusterAdminClient extends AbstractComponent imple @Override public void nodesShutdown(final NodesShutdownRequest request, final ActionListener<NodesShutdownResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<Void>>() { - @Override public ActionFuture<Void> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<Void> doWithNode(DiscoveryNode node) throws ElasticSearchException { nodesShutdownAction.execute(node, request, listener); return null; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java index d55ab7210b804..170f711c73a2f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/support/InternalTransportIndicesAdminClient.java @@ -55,7 +55,7 @@ import org.elasticsearch.client.transport.action.admin.indices.optimize.ClientTransportOptimizeAction; import org.elasticsearch.client.transport.action.admin.indices.refresh.ClientTransportRefreshAction; import org.elasticsearch.client.transport.action.admin.indices.status.ClientTransportIndicesStatusAction; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.component.AbstractComponent; import org.elasticsearch.util.settings.Settings; @@ -108,7 +108,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<IndicesStatusResponse> status(final IndicesStatusRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndicesStatusResponse>>() { - @Override public ActionFuture<IndicesStatusResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<IndicesStatusResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return indicesStatusAction.execute(node, request); } }); @@ -116,7 +116,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void status(final IndicesStatusRequest request, final ActionListener<IndicesStatusResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { indicesStatusAction.execute(node, request, listener); return null; } @@ -125,7 +125,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<CreateIndexResponse> create(final CreateIndexRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<CreateIndexResponse>>() { - @Override public ActionFuture<CreateIndexResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<CreateIndexResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return createIndexAction.execute(node, request); } }); @@ -133,7 +133,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void create(final CreateIndexRequest request, final ActionListener<CreateIndexResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { createIndexAction.execute(node, request, listener); return null; } @@ -142,7 +142,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<DeleteIndexResponse> delete(final DeleteIndexRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<DeleteIndexResponse>>() { - @Override public ActionFuture<DeleteIndexResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<DeleteIndexResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return deleteIndexAction.execute(node, request); } }); @@ -150,7 +150,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void delete(final DeleteIndexRequest request, final ActionListener<DeleteIndexResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { deleteIndexAction.execute(node, request, listener); return null; } @@ -159,7 +159,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<RefreshResponse> refresh(final RefreshRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<RefreshResponse>>() { - @Override public ActionFuture<RefreshResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<RefreshResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return refreshAction.execute(node, request); } }); @@ -167,7 +167,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void refresh(final RefreshRequest request, final ActionListener<RefreshResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { refreshAction.execute(node, request, listener); return null; } @@ -176,7 +176,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<FlushResponse> flush(final FlushRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<FlushResponse>>() { - @Override public ActionFuture<FlushResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<FlushResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return flushAction.execute(node, request); } }); @@ -184,7 +184,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void flush(final FlushRequest request, final ActionListener<FlushResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { flushAction.execute(node, request, listener); return null; } @@ -193,7 +193,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<OptimizeResponse> optimize(final OptimizeRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<OptimizeResponse>>() { - @Override public ActionFuture<OptimizeResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<OptimizeResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return optimizeAction.execute(node, request); } }); @@ -201,7 +201,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void optimize(final OptimizeRequest request, final ActionListener<OptimizeResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<Void>>() { - @Override public ActionFuture<Void> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<Void> doWithNode(DiscoveryNode node) throws ElasticSearchException { optimizeAction.execute(node, request, listener); return null; } @@ -210,7 +210,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<PutMappingResponse> putMapping(final PutMappingRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<PutMappingResponse>>() { - @Override public ActionFuture<PutMappingResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<PutMappingResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return putMappingAction.execute(node, request); } }); @@ -218,7 +218,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void putMapping(final PutMappingRequest request, final ActionListener<PutMappingResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { putMappingAction.execute(node, request, listener); return null; } @@ -227,7 +227,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<GatewaySnapshotResponse> gatewaySnapshot(final GatewaySnapshotRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<GatewaySnapshotResponse>>() { - @Override public ActionFuture<GatewaySnapshotResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<GatewaySnapshotResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return gatewaySnapshotAction.execute(node, request); } }); @@ -235,7 +235,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void gatewaySnapshot(final GatewaySnapshotRequest request, final ActionListener<GatewaySnapshotResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Object>() { - @Override public Object doWithNode(Node node) throws ElasticSearchException { + @Override public Object doWithNode(DiscoveryNode node) throws ElasticSearchException { gatewaySnapshotAction.execute(node, request, listener); return null; } @@ -244,7 +244,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<IndicesAliasesResponse> aliases(final IndicesAliasesRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<IndicesAliasesResponse>>() { - @Override public ActionFuture<IndicesAliasesResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<IndicesAliasesResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return indicesAliasesAction.execute(node, request); } }); @@ -252,7 +252,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void aliases(final IndicesAliasesRequest request, final ActionListener<IndicesAliasesResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { indicesAliasesAction.execute(node, request, listener); return null; } @@ -261,7 +261,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public ActionFuture<ClearIndicesCacheResponse> clearCache(final ClearIndicesCacheRequest request) { return nodesService.execute(new TransportClientNodesService.NodeCallback<ActionFuture<ClearIndicesCacheResponse>>() { - @Override public ActionFuture<ClearIndicesCacheResponse> doWithNode(Node node) throws ElasticSearchException { + @Override public ActionFuture<ClearIndicesCacheResponse> doWithNode(DiscoveryNode node) throws ElasticSearchException { return clearIndicesCacheAction.execute(node, request); } }); @@ -269,7 +269,7 @@ public class InternalTransportIndicesAdminClient extends AbstractComponent imple @Override public void clearCache(final ClearIndicesCacheRequest request, final ActionListener<ClearIndicesCacheResponse> listener) { nodesService.execute(new TransportClientNodesService.NodeCallback<Void>() { - @Override public Void doWithNode(Node node) throws ElasticSearchException { + @Override public Void doWithNode(DiscoveryNode node) throws ElasticSearchException { clearIndicesCacheAction.execute(node, request, listener); return null; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java index 62b70fe9d2fd0..8f829cd758c74 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterChangedEvent.java @@ -19,7 +19,7 @@ package org.elasticsearch.cluster; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; /** * @author kimchy (Shay Banon) @@ -34,7 +34,7 @@ public class ClusterChangedEvent { private final boolean firstMaster; - private final Nodes.Delta nodesDelta; + private final DiscoveryNodes.Delta nodesDelta; public ClusterChangedEvent(String source, ClusterState state, ClusterState previousState, boolean firstMaster) { this.source = source; @@ -75,7 +75,7 @@ public boolean firstMaster() { return firstMaster; } - public Nodes.Delta nodesDelta() { + public DiscoveryNodes.Delta nodesDelta() { return this.nodesDelta; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java index 0b85e1bdc8c46..44232580a4592 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java @@ -20,8 +20,8 @@ package org.elasticsearch.cluster; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.util.Nullable; @@ -42,14 +42,14 @@ public class ClusterState { private final RoutingTable routingTable; - private final Nodes nodes; + private final DiscoveryNodes nodes; private final MetaData metaData; // built on demand private volatile RoutingNodes routingNodes; - public ClusterState(long version, MetaData metaData, RoutingTable routingTable, Nodes nodes) { + public ClusterState(long version, MetaData metaData, RoutingTable routingTable, DiscoveryNodes nodes) { this.version = version; this.metaData = metaData; this.routingTable = routingTable; @@ -60,7 +60,7 @@ public long version() { return this.version; } - public Nodes nodes() { + public DiscoveryNodes nodes() { return this.nodes; } @@ -100,13 +100,13 @@ public static class Builder { private RoutingTable routingTable = RoutingTable.EMPTY_ROUTING_TABLE; - private Nodes nodes = Nodes.EMPTY_NODES; + private DiscoveryNodes nodes = DiscoveryNodes.EMPTY_NODES; - public Builder nodes(Nodes.Builder nodesBuilder) { + public Builder nodes(DiscoveryNodes.Builder nodesBuilder) { return nodes(nodesBuilder.build()); } - public Builder nodes(Nodes nodes) { + public Builder nodes(DiscoveryNodes nodes) { this.nodes = nodes; return this; } @@ -147,7 +147,7 @@ public static byte[] toBytes(ClusterState state) throws IOException { return os.copiedByteArray(); } - public static ClusterState fromBytes(byte[] data, Settings globalSettings, Node localNode) throws IOException { + public static ClusterState fromBytes(byte[] data, Settings globalSettings, DiscoveryNode localNode) throws IOException { return readFrom(new BytesStreamInput(data), globalSettings, localNode); } @@ -155,15 +155,15 @@ public static void writeTo(ClusterState state, StreamOutput out) throws IOExcept out.writeLong(state.version()); MetaData.Builder.writeTo(state.metaData(), out); RoutingTable.Builder.writeTo(state.routingTable(), out); - Nodes.Builder.writeTo(state.nodes(), out); + DiscoveryNodes.Builder.writeTo(state.nodes(), out); } - public static ClusterState readFrom(StreamInput in, @Nullable Settings globalSettings, @Nullable Node localNode) throws IOException { + public static ClusterState readFrom(StreamInput in, @Nullable Settings globalSettings, @Nullable DiscoveryNode localNode) throws IOException { Builder builder = new Builder(); builder.version = in.readLong(); builder.metaData = MetaData.Builder.readFrom(in, globalSettings); builder.routingTable = RoutingTable.Builder.readFrom(in); - builder.nodes = Nodes.Builder.readFrom(in, localNode); + builder.nodes = DiscoveryNodes.Builder.readFrom(in, localNode); return builder.build(); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java index deb15e97a5155..e9affa656f13e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java @@ -22,7 +22,7 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; @@ -69,7 +69,7 @@ public void remove(Listener listener) { } public void nodeIndexCreated(final String index, final String nodeId) throws ElasticSearchException { - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java index e6a1a686b9076..8df5b788f315e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java @@ -22,7 +22,7 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; @@ -69,7 +69,7 @@ public void remove(Listener listener) { } public void nodeIndexDeleted(final String index, final String nodeId) throws ElasticSearchException { - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java index 82c0618416df7..8cef1f8bfbf3d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java @@ -22,7 +22,7 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; @@ -69,7 +69,7 @@ public void remove(Listener listener) { } public void nodeMappingCreated(final NodeMappingCreatedResponse response) throws ElasticSearchException { - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java index be28fc628bb2f..cbd7fc78f734f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java @@ -24,7 +24,7 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.RoutingTable; @@ -75,7 +75,7 @@ public class ShardStateAction extends AbstractComponent { public void shardFailed(final ShardRouting shardRouting, final String reason) throws ElasticSearchException { logger.warn("Sending failed shard for {}, reason [{}]", shardRouting, reason); - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { @@ -92,7 +92,7 @@ public void shardStarted(final ShardRouting shardRouting, final String reason) t if (logger.isDebugEnabled()) { logger.debug("Sending shard started for {}, reason [{}]", shardRouting, reason); } - Nodes nodes = clusterService.state().nodes(); + DiscoveryNodes nodes = clusterService.state().nodes(); if (nodes.localNodeMaster()) { threadPool.execute(new Runnable() { @Override public void run() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Node.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java similarity index 86% rename from modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Node.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java index 678ac34445c21..7a6f35380fe72 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Node.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java @@ -33,9 +33,9 @@ /** * @author kimchy (Shay Banon) */ -public class Node implements Streamable, Serializable { +public class DiscoveryNode implements Streamable, Serializable { - public static final ImmutableList<Node> EMPTY_LIST = ImmutableList.of(); + public static final ImmutableList<DiscoveryNode> EMPTY_LIST = ImmutableList.of(); private String nodeName = StringHelper.intern(""); @@ -45,14 +45,14 @@ public class Node implements Streamable, Serializable { private boolean dataNode = true; - private Node() { + private DiscoveryNode() { } - public Node(String nodeId, TransportAddress address) { + public DiscoveryNode(String nodeId, TransportAddress address) { this("", true, nodeId, address); } - public Node(String nodeName, boolean dataNode, String nodeId, TransportAddress address) { + public DiscoveryNode(String nodeName, boolean dataNode, String nodeId, TransportAddress address) { if (nodeName == null) { this.nodeName = StringHelper.intern(""); } else { @@ -91,8 +91,8 @@ public boolean dataNode() { return dataNode; } - public static Node readNode(StreamInput in) throws IOException { - Node node = new Node(); + public static DiscoveryNode readNode(StreamInput in) throws IOException { + DiscoveryNode node = new DiscoveryNode(); node.readFrom(in); return node; } @@ -112,10 +112,10 @@ public static Node readNode(StreamInput in) throws IOException { } @Override public boolean equals(Object obj) { - if (!(obj instanceof Node)) + if (!(obj instanceof DiscoveryNode)) return false; - Node other = (Node) obj; + DiscoveryNode other = (DiscoveryNode) obj; return this.nodeId.equals(other.nodeId); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Nodes.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java similarity index 73% rename from modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Nodes.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java index 09e10599c673e..dea023aae1e0e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/Nodes.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java @@ -37,26 +37,26 @@ /** * @author kimchy (Shay Banon) */ -public class Nodes implements Iterable<Node> { +public class DiscoveryNodes implements Iterable<DiscoveryNode> { - public static Nodes EMPTY_NODES = newNodesBuilder().build(); + public static DiscoveryNodes EMPTY_NODES = newNodesBuilder().build(); - private final ImmutableMap<String, Node> nodes; + private final ImmutableMap<String, DiscoveryNode> nodes; - private final ImmutableMap<String, Node> dataNodes; + private final ImmutableMap<String, DiscoveryNode> dataNodes; private final String masterNodeId; private final String localNodeId; - private Nodes(ImmutableMap<String, Node> nodes, ImmutableMap<String, Node> dataNodes, String masterNodeId, String localNodeId) { + private DiscoveryNodes(ImmutableMap<String, DiscoveryNode> nodes, ImmutableMap<String, DiscoveryNode> dataNodes, String masterNodeId, String localNodeId) { this.nodes = nodes; this.dataNodes = dataNodes; this.masterNodeId = masterNodeId; this.localNodeId = localNodeId; } - @Override public UnmodifiableIterator<Node> iterator() { + @Override public UnmodifiableIterator<DiscoveryNode> iterator() { return nodes.values().iterator(); } @@ -83,15 +83,15 @@ public int size() { return nodes.size(); } - public ImmutableMap<String, Node> nodes() { + public ImmutableMap<String, DiscoveryNode> nodes() { return this.nodes; } - public ImmutableMap<String, Node> dataNodes() { + public ImmutableMap<String, DiscoveryNode> dataNodes() { return this.dataNodes; } - public Node get(String nodeId) { + public DiscoveryNode get(String nodeId) { return nodes.get(nodeId); } @@ -107,17 +107,17 @@ public String localNodeId() { return this.localNodeId; } - public Node localNode() { + public DiscoveryNode localNode() { return nodes.get(localNodeId); } - public Node masterNode() { + public DiscoveryNode masterNode() { return nodes.get(masterNodeId); } - public Nodes removeDeadMembers(Set<String> newNodes, String masterNodeId) { + public DiscoveryNodes removeDeadMembers(Set<String> newNodes, String masterNodeId) { Builder builder = new Builder().masterNodeId(masterNodeId).localNodeId(localNodeId); - for (Node node : this) { + for (DiscoveryNode node : this) { if (newNodes.contains(node.id())) { builder.put(node); } @@ -125,28 +125,28 @@ public Nodes removeDeadMembers(Set<String> newNodes, String masterNodeId) { return builder.build(); } - public Nodes newNode(Node node) { + public DiscoveryNodes newNode(DiscoveryNode node) { return new Builder().putAll(this).put(node).build(); } /** * Returns the changes comparing this nodes to the provided nodes. */ - public Delta delta(Nodes other) { - List<Node> removed = newArrayList(); - List<Node> added = newArrayList(); - for (Node node : other) { + public Delta delta(DiscoveryNodes other) { + List<DiscoveryNode> removed = newArrayList(); + List<DiscoveryNode> added = newArrayList(); + for (DiscoveryNode node : other) { if (!this.nodeExists(node.id())) { removed.add(node); } } - for (Node node : this) { + for (DiscoveryNode node : this) { if (!other.nodeExists(node.id())) { added.add(node); } } - Node previousMasterNode = null; - Node newMasterNode = null; + DiscoveryNode previousMasterNode = null; + DiscoveryNode newMasterNode = null; if (masterNodeId != null) { if (other.masterNodeId == null || !other.masterNodeId.equals(masterNodeId)) { previousMasterNode = other.masterNode(); @@ -159,7 +159,7 @@ public Delta delta(Nodes other) { public String prettyPrint() { StringBuilder sb = new StringBuilder(); sb.append("Nodes: \n"); - for (Node node : this) { + for (DiscoveryNode node : this) { sb.append(" ").append(node); if (node == localNode()) { sb.append(", local"); @@ -173,23 +173,23 @@ public String prettyPrint() { } public Delta emptyDelta() { - return new Delta(null, null, localNodeId, Node.EMPTY_LIST, Node.EMPTY_LIST); + return new Delta(null, null, localNodeId, DiscoveryNode.EMPTY_LIST, DiscoveryNode.EMPTY_LIST); } public static class Delta { private final String localNodeId; - private final Node previousMasterNode; - private final Node newMasterNode; - private final ImmutableList<Node> removed; - private final ImmutableList<Node> added; + private final DiscoveryNode previousMasterNode; + private final DiscoveryNode newMasterNode; + private final ImmutableList<DiscoveryNode> removed; + private final ImmutableList<DiscoveryNode> added; - public Delta(String localNodeId, ImmutableList<Node> removed, ImmutableList<Node> added) { + public Delta(String localNodeId, ImmutableList<DiscoveryNode> removed, ImmutableList<DiscoveryNode> added) { this(null, null, localNodeId, removed, added); } - public Delta(@Nullable Node previousMasterNode, @Nullable Node newMasterNode, String localNodeId, ImmutableList<Node> removed, ImmutableList<Node> added) { + public Delta(@Nullable DiscoveryNode previousMasterNode, @Nullable DiscoveryNode newMasterNode, String localNodeId, ImmutableList<DiscoveryNode> removed, ImmutableList<DiscoveryNode> added) { this.previousMasterNode = previousMasterNode; this.newMasterNode = newMasterNode; this.localNodeId = localNodeId; @@ -205,11 +205,11 @@ public boolean masterNodeChanged() { return newMasterNode != null; } - public Node previousMasterNode() { + public DiscoveryNode previousMasterNode() { return previousMasterNode; } - public Node newMasterNode() { + public DiscoveryNode newMasterNode() { return newMasterNode; } @@ -217,7 +217,7 @@ public boolean removed() { return !removed.isEmpty(); } - public ImmutableList<Node> removedNodes() { + public ImmutableList<DiscoveryNode> removedNodes() { return removed; } @@ -225,7 +225,7 @@ public boolean added() { return !added.isEmpty(); } - public ImmutableList<Node> addedNodes() { + public ImmutableList<DiscoveryNode> addedNodes() { return added; } @@ -252,7 +252,7 @@ public String shortSummary() { sb.append(", "); } sb.append("Removed {"); - for (Node node : removedNodes()) { + for (DiscoveryNode node : removedNodes()) { sb.append(node).append(','); } sb.append("}"); @@ -265,7 +265,7 @@ public String shortSummary() { sb.append(", "); } sb.append("Added {"); - for (Node node : addedNodes()) { + for (DiscoveryNode node : addedNodes()) { if (!node.id().equals(localNodeId)) { // don't print ourself sb.append(node).append(','); @@ -284,28 +284,28 @@ public static Builder newNodesBuilder() { public static class Builder { - private Map<String, Node> nodes = newHashMap(); + private Map<String, DiscoveryNode> nodes = newHashMap(); private String masterNodeId; private String localNodeId; - public Builder putAll(Nodes nodes) { + public Builder putAll(DiscoveryNodes nodes) { this.masterNodeId = nodes.masterNodeId(); this.localNodeId = nodes.localNodeId(); - for (Node node : nodes) { + for (DiscoveryNode node : nodes) { put(node); } return this; } - public Builder put(Node node) { + public Builder put(DiscoveryNode node) { nodes.put(node.id(), node); return this; } - public Builder putAll(Iterable<Node> nodes) { - for (Node node : nodes) { + public Builder putAll(Iterable<DiscoveryNode> nodes) { + for (DiscoveryNode node : nodes) { put(node); } return this; @@ -326,25 +326,25 @@ public Builder localNodeId(String localNodeId) { return this; } - public Nodes build() { - ImmutableMap.Builder<String, Node> dataNodesBuilder = ImmutableMap.builder(); - for (Map.Entry<String, Node> nodeEntry : nodes.entrySet()) { + public DiscoveryNodes build() { + ImmutableMap.Builder<String, DiscoveryNode> dataNodesBuilder = ImmutableMap.builder(); + for (Map.Entry<String, DiscoveryNode> nodeEntry : nodes.entrySet()) { if (nodeEntry.getValue().dataNode()) { dataNodesBuilder.put(nodeEntry.getKey(), nodeEntry.getValue()); } } - return new Nodes(ImmutableMap.copyOf(nodes), dataNodesBuilder.build(), masterNodeId, localNodeId); + return new DiscoveryNodes(ImmutableMap.copyOf(nodes), dataNodesBuilder.build(), masterNodeId, localNodeId); } - public static void writeTo(Nodes nodes, StreamOutput out) throws IOException { + public static void writeTo(DiscoveryNodes nodes, StreamOutput out) throws IOException { out.writeUTF(nodes.masterNodeId); out.writeVInt(nodes.size()); - for (Node node : nodes) { + for (DiscoveryNode node : nodes) { node.writeTo(out); } } - public static Nodes readFrom(StreamInput in, @Nullable Node localNode) throws IOException { + public static DiscoveryNodes readFrom(StreamInput in, @Nullable DiscoveryNode localNode) throws IOException { Builder builder = new Builder(); builder.masterNodeId(in.readUTF()); if (localNode != null) { @@ -352,7 +352,7 @@ public static Nodes readFrom(StreamInput in, @Nullable Node localNode) throws IO } int size = in.readVInt(); for (int i = 0; i < size; i++) { - Node node = Node.readNode(in); + DiscoveryNode node = DiscoveryNode.readNode(in); if (localNode != null && node.id().equals(localNode.id())) { // reuse the same instance of our address and local node id for faster equality node = localNode; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/DefaultShardsRoutingStrategy.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/DefaultShardsRoutingStrategy.java index c22417421916a..6a7052a327681 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/DefaultShardsRoutingStrategy.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/DefaultShardsRoutingStrategy.java @@ -20,7 +20,7 @@ package org.elasticsearch.cluster.routing.strategy; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.*; import java.util.Iterator; @@ -54,7 +54,7 @@ public class DefaultShardsRoutingStrategy implements ShardsRoutingStrategy { @Override public RoutingTable reroute(ClusterState clusterState) { RoutingNodes routingNodes = clusterState.routingNodes(); - Iterable<Node> dataNodes = clusterState.nodes().dataNodes().values(); + Iterable<DiscoveryNode> dataNodes = clusterState.nodes().dataNodes().values(); boolean changed = false; // first, clear from the shards any node id they used to belong to that is now dead @@ -212,8 +212,8 @@ private boolean allocateUnassigned(RoutingNodes routingNodes) { * * @param liveNodes currently live nodes. */ - private void applyNewNodes(RoutingNodes routingNodes, Iterable<Node> liveNodes) { - for (Node node : liveNodes) { + private void applyNewNodes(RoutingNodes routingNodes, Iterable<DiscoveryNode> liveNodes) { + for (DiscoveryNode node : liveNodes) { if (!routingNodes.nodesToShards().containsKey(node.id())) { RoutingNode routingNode = new RoutingNode(node.id()); routingNodes.nodesToShards().put(node.id(), routingNode); @@ -221,10 +221,10 @@ private void applyNewNodes(RoutingNodes routingNodes, Iterable<Node> liveNodes) } } - private boolean deassociateDeadNodes(RoutingNodes routingNodes, Iterable<Node> liveNodes) { + private boolean deassociateDeadNodes(RoutingNodes routingNodes, Iterable<DiscoveryNode> liveNodes) { boolean changed = false; Set<String> liveNodeIds = newHashSet(); - for (Node liveNode : liveNodes) { + for (DiscoveryNode liveNode : liveNodes) { liveNodeIds.add(liveNode.id()); } Set<String> nodeIdsToRemove = newHashSet(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java index f6c97ba5f76a1..5fb356c7a39f4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java @@ -22,7 +22,7 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.*; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; @@ -172,7 +172,7 @@ public void submitStateUpdateTask(final String source, final ClusterStateUpdateT ClusterChangedEvent clusterChangedEvent = new ClusterChangedEvent(source, clusterState, previousClusterState, discoveryService.firstMaster()); // new cluster state, notify all listeners - final Nodes.Delta nodesDelta = clusterChangedEvent.nodesDelta(); + final DiscoveryNodes.Delta nodesDelta = clusterChangedEvent.nodesDelta(); if (nodesDelta.hasChanges() && logger.isInfoEnabled()) { String summary = nodesDelta.shortSummary(); if (summary.length() > 0) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java index cb92631e77484..a4edcb21c4ae3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java @@ -23,8 +23,8 @@ import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.cluster.*; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.DiscoveryException; import org.elasticsearch.discovery.InitialStateDiscoveryListener; @@ -70,7 +70,7 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent<Discovery> impl private volatile boolean addressSet = false; - private Node localNode; + private DiscoveryNode localNode; private volatile boolean firstMaster = false; @@ -142,13 +142,13 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent<Discovery> impl channel.connect(clusterName.value()); channel.setReceiver(this); logger.debug("Connected to cluster [{}], address [{}]", channel.getClusterName(), channel.getAddress()); - this.localNode = new Node(settings.get("name"), settings.getAsBoolean("node.data", true), channel.getAddress().toString(), transportService.boundAddress().publishAddress()); + this.localNode = new DiscoveryNode(settings.get("name"), settings.getAsBoolean("node.data", true), channel.getAddress().toString(), transportService.boundAddress().publishAddress()); if (isMaster()) { firstMaster = true; clusterService.submitStateUpdateTask("jgroups-disco-initialconnect(master)", new ProcessedClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes.Builder builder = new Nodes.Builder() + DiscoveryNodes.Builder builder = new DiscoveryNodes.Builder() .localNodeId(localNode.id()) .masterNodeId(localNode.id()) // put our local node @@ -164,7 +164,7 @@ public class JgroupsDiscovery extends AbstractLifecycleComponent<Discovery> impl } else { clusterService.submitStateUpdateTask("jgroups-disco-initialconnect", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes.Builder builder = new Nodes.Builder() + DiscoveryNodes.Builder builder = new DiscoveryNodes.Builder() .localNodeId(localNode.id()) .put(localNode); return newClusterStateBuilder().state(currentState).nodes(builder).build(); @@ -248,7 +248,7 @@ public String nodeDescription() { if (isMaster()) { try { BytesStreamInput is = new BytesStreamInput(msg.getBuffer()); - final Node newNode = Node.readNode(is); + final DiscoveryNode newNode = DiscoveryNode.readNode(is); is.close(); if (logger.isDebugEnabled()) { @@ -310,8 +310,8 @@ private boolean isMaster() { clusterService.submitStateUpdateTask("jgroups-disco-view", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes newNodes = currentState.nodes().removeDeadMembers(newMembers, newView.getCreator().toString()); - Nodes.Delta delta = newNodes.delta(currentState.nodes()); + DiscoveryNodes newNodes = currentState.nodes().removeDeadMembers(newMembers, newView.getCreator().toString()); + DiscoveryNodes.Delta delta = newNodes.delta(currentState.nodes()); if (delta.added()) { logger.warn("No new nodes should be created when a new discovery view is accepted"); } @@ -328,7 +328,7 @@ private boolean isMaster() { // check whether I have been removed due to temporary disconnect final String me = channel.getAddress().toString(); boolean foundMe = false; - for (Node node : clusterService.state().nodes()) { + for (DiscoveryNode node : clusterService.state().nodes()) { if (node.id().equals(me)) { foundMe = true; break; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java index 045c78aabd66c..a04105975a045 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java @@ -23,8 +23,8 @@ import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.cluster.*; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.InitialStateDiscoveryListener; import org.elasticsearch.transport.TransportService; @@ -54,7 +54,7 @@ public class LocalDiscovery extends AbstractLifecycleComponent<Discovery> implem private final ClusterName clusterName; - private Node localNode; + private DiscoveryNode localNode; private volatile boolean master = false; @@ -84,7 +84,7 @@ public class LocalDiscovery extends AbstractLifecycleComponent<Discovery> implem clusterGroups.put(clusterName, clusterGroup); } logger.debug("Connected to cluster [{}]", clusterName); - this.localNode = new Node(settings.get("name"), settings.getAsBoolean("node.data", true), Long.toString(nodeIdGenerator.incrementAndGet()), transportService.boundAddress().publishAddress()); + this.localNode = new DiscoveryNode(settings.get("name"), settings.getAsBoolean("node.data", true), Long.toString(nodeIdGenerator.incrementAndGet()), transportService.boundAddress().publishAddress()); clusterGroup.members().add(this); if (clusterGroup.members().size() == 1) { @@ -93,7 +93,7 @@ public class LocalDiscovery extends AbstractLifecycleComponent<Discovery> implem firstMaster = true; clusterService.submitStateUpdateTask("local-disco-initialconnect(master)", new ProcessedClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes.Builder builder = new Nodes.Builder() + DiscoveryNodes.Builder builder = new DiscoveryNodes.Builder() .localNodeId(localNode.id()) .masterNodeId(localNode.id()) // put our local node @@ -153,8 +153,8 @@ public class LocalDiscovery extends AbstractLifecycleComponent<Discovery> implem masterDiscovery.clusterService.submitStateUpdateTask("local-disco-update", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { - Nodes newNodes = currentState.nodes().removeDeadMembers(newMembers, masterDiscovery.localNode.id()); - Nodes.Delta delta = newNodes.delta(currentState.nodes()); + DiscoveryNodes newNodes = currentState.nodes().removeDeadMembers(newMembers, masterDiscovery.localNode.id()); + DiscoveryNodes.Delta delta = newNodes.delta(currentState.nodes()); if (delta.added()) { logger.warn("No new nodes should be created when a new discovery view is accepted"); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java index 04d8009a8c12d..825b738321e19 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java @@ -25,7 +25,7 @@ import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchInterruptedException; import org.elasticsearch.ExceptionsHelper; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.index.deletionpolicy.SnapshotIndexCommit; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.engine.RecoveryEngineException; @@ -135,7 +135,7 @@ public void close() { } } - public synchronized void startRecovery(Node node, Node targetNode, boolean markAsRelocated) throws ElasticSearchException { + public synchronized void startRecovery(DiscoveryNode node, DiscoveryNode targetNode, boolean markAsRelocated) throws ElasticSearchException { sendStartRecoveryThread = Thread.currentThread(); try { // mark the shard as recovering @@ -224,20 +224,20 @@ private void cleanOpenIndex() { private static class StartRecoveryRequest implements Streamable { - private Node node; + private DiscoveryNode node; private boolean markAsRelocated; private StartRecoveryRequest() { } - private StartRecoveryRequest(Node node, boolean markAsRelocated) { + private StartRecoveryRequest(DiscoveryNode node, boolean markAsRelocated) { this.node = node; this.markAsRelocated = markAsRelocated; } @Override public void readFrom(StreamInput in) throws IOException { - node = Node.readNode(in); + node = DiscoveryNode.readNode(in); markAsRelocated = in.readBoolean(); } @@ -255,7 +255,7 @@ private class StartRecoveryTransportRequestHandler extends BaseTransportRequestH @Override public void messageReceived(final StartRecoveryRequest startRecoveryRequest, final TransportChannel channel) throws Exception { logger.trace("Starting recovery to {}, markAsRelocated {}", startRecoveryRequest.node, startRecoveryRequest.markAsRelocated); - final Node node = startRecoveryRequest.node; + final DiscoveryNode node = startRecoveryRequest.node; cleanOpenIndex(); final RecoveryStatus recoveryStatus = new RecoveryStatus(); indexShard.recover(new Engine.RecoveryHandler() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryFailedException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryFailedException.java index 71c38e34c4722..3ce9bea28f1dc 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryFailedException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryFailedException.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.shard.recovery; import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.index.shard.ShardId; /** @@ -28,7 +28,7 @@ */ public class RecoveryFailedException extends ElasticSearchException { - public RecoveryFailedException(ShardId shardId, Node node, Node targetNode, Throwable cause) { + public RecoveryFailedException(ShardId shardId, DiscoveryNode node, DiscoveryNode targetNode, Throwable cause) { super(shardId + ": Recovery failed from " + targetNode + " into " + node, cause); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java index 537bcc814c5f7..60aeec46d69c1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java @@ -30,8 +30,8 @@ import org.elasticsearch.cluster.action.index.NodeMappingCreatedAction; import org.elasticsearch.cluster.action.shard.ShardStateAction; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.RoutingTable; @@ -228,7 +228,7 @@ private void applyNewShards(final ClusterChangedEvent event) throws ElasticSearc if (routingNodes == null) { return; } - Nodes nodes = event.state().nodes(); + DiscoveryNodes nodes = event.state().nodes(); for (final ShardRouting shardRouting : routingNodes) { @@ -257,7 +257,7 @@ private void applyNewShards(final ClusterChangedEvent event) throws ElasticSearc } } - private void applyInitializingShard(final RoutingTable routingTable, final Nodes nodes, final ShardRouting shardRouting) throws ElasticSearchException { + private void applyInitializingShard(final RoutingTable routingTable, final DiscoveryNodes nodes, final ShardRouting shardRouting) throws ElasticSearchException { final IndexService indexService = indicesService.indexServiceSafe(shardRouting.index()); final int shardId = shardRouting.id(); @@ -322,7 +322,7 @@ private void applyInitializingShard(final RoutingTable routingTable, final Nodes for (ShardRouting entry : shardRoutingTable) { if (entry.primary() && entry.started()) { // only recover from started primary, if we can't find one, we will do it next round - Node node = nodes.get(entry.currentNodeId()); + DiscoveryNode node = nodes.get(entry.currentNodeId()); try { // we are recovering a backup from a primary, so no need to mark it as relocated recoveryAction.startRecovery(nodes.localNode(), node, false); @@ -346,7 +346,7 @@ private void applyInitializingShard(final RoutingTable routingTable, final Nodes } } else { // relocating primaries, recovery from the relocating shard - Node node = nodes.get(shardRouting.relocatingNodeId()); + DiscoveryNode node = nodes.get(shardRouting.relocatingNodeId()); try { // we mark the primary we are going to recover from as relocated at the end of phase 3 // so operations will start moving to the new primary diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/JmxClusterService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/JmxClusterService.java index 936b60b7b8f89..37ee3725a5316 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/JmxClusterService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/JmxClusterService.java @@ -22,7 +22,7 @@ import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterStateListener; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.jmx.action.GetJmxServiceUrlAction; import org.elasticsearch.util.component.AbstractComponent; import org.elasticsearch.util.settings.Settings; @@ -60,7 +60,7 @@ public JmxClusterService(Settings settings, ClusterService clusterService, JmxSe if (jmxService.publishUrl() != null) { clusterService.add(new JmxClusterEventListener()); - for (final Node node : clusterService.state().nodes()) { + for (final DiscoveryNode node : clusterService.state().nodes()) { clusterNodesJmxUpdater.execute(new Runnable() { @Override public void run() { String nodeServiceUrl = getJmxServiceUrlAction.obtainPublishUrl(node); @@ -77,7 +77,7 @@ public void close() { } } - private void registerNode(Node node, String nodeServiceUrl) { + private void registerNode(DiscoveryNode node, String nodeServiceUrl) { try { JMXServiceURL jmxServiceURL = new JMXServiceURL(nodeServiceUrl); JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceURL, null); @@ -103,7 +103,7 @@ private class JmxClusterEventListener implements ClusterStateListener { if (!event.nodesChanged()) { return; } - for (final Node node : event.nodesDelta().addedNodes()) { + for (final DiscoveryNode node : event.nodesDelta().addedNodes()) { clusterNodesJmxUpdater.execute(new Runnable() { @Override public void run() { String nodeServiceUrl = getJmxServiceUrlAction.obtainPublishUrl(node); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/action/GetJmxServiceUrlAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/action/GetJmxServiceUrlAction.java index 15d60e413b0c1..62f5e172f860d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/action/GetJmxServiceUrlAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/action/GetJmxServiceUrlAction.java @@ -22,7 +22,7 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.jmx.JmxService; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.FutureTransportResponseHandler; @@ -54,7 +54,7 @@ public class GetJmxServiceUrlAction extends AbstractComponent { transportService.registerHandler(GetJmxServiceUrlTransportHandler.ACTION, new GetJmxServiceUrlTransportHandler()); } - public String obtainPublishUrl(final Node node) throws ElasticSearchException { + public String obtainPublishUrl(final DiscoveryNode node) throws ElasticSearchException { if (clusterService.state().nodes().localNodeId().equals(node.id())) { return jmxService.publishUrl(); } else { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/dump/SimpleDumpGenerator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/dump/SimpleDumpGenerator.java index af97d7389b564..2c148c2a27dfb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/dump/SimpleDumpGenerator.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/dump/SimpleDumpGenerator.java @@ -20,7 +20,7 @@ package org.elasticsearch.monitor.dump; import com.google.common.collect.ImmutableMap; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.Nullable; import java.io.File; @@ -50,7 +50,7 @@ public Result generateDump(String cause, @Nullable Map<String, Object> context, long timestamp = System.currentTimeMillis(); String fileName = ""; if (context.containsKey("localNode")) { - Node localNode = (Node) context.get("localNode"); + DiscoveryNode localNode = (DiscoveryNode) context.get("localNode"); if (localNode.name() != null) { fileName += localNode.name() + "-"; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/dump/cluster/ClusterDumpContributor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/dump/cluster/ClusterDumpContributor.java index 4f1e22ffbe0c4..1335ada63ee72 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/dump/cluster/ClusterDumpContributor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/dump/cluster/ClusterDumpContributor.java @@ -23,7 +23,7 @@ import com.google.inject.assistedinject.Assisted; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.monitor.dump.Dump; import org.elasticsearch.monitor.dump.DumpContributionFailedException; @@ -54,7 +54,7 @@ public class ClusterDumpContributor implements DumpContributor { @Override public void contribute(Dump dump) throws DumpContributionFailedException { ClusterState clusterState = clusterService.state(); - Nodes nodes = clusterState.nodes(); + DiscoveryNodes nodes = clusterState.nodes(); RoutingTable routingTable = clusterState.routingTable(); PrintWriter writer = new PrintWriter(dump.createFileWriter("cluster.txt")); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/action/SearchServiceTransportAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/action/SearchServiceTransportAction.java index 5d869050ba443..466b642c35a69 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/action/SearchServiceTransportAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/action/SearchServiceTransportAction.java @@ -21,7 +21,7 @@ import com.google.inject.Inject; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.search.SearchService; import org.elasticsearch.search.dfs.DfsSearchResult; import org.elasticsearch.search.fetch.FetchSearchRequest; @@ -65,7 +65,7 @@ public class SearchServiceTransportAction { transportService.registerHandler(SearchFetchByIdTransportHandler.ACTION, new SearchFetchByIdTransportHandler()); } - public void sendFreeContext(Node node, final long contextId) { + public void sendFreeContext(DiscoveryNode node, final long contextId) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { searchService.freeContext(contextId); } else { @@ -73,7 +73,7 @@ public void sendFreeContext(Node node, final long contextId) { } } - public void sendExecuteDfs(Node node, final InternalSearchRequest request, final SearchServiceListener<DfsSearchResult> listener) { + public void sendExecuteDfs(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener<DfsSearchResult> listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { DfsSearchResult result = searchService.executeDfsPhase(request); @@ -103,7 +103,7 @@ public void sendExecuteDfs(Node node, final InternalSearchRequest request, final } } - public void sendExecuteQuery(Node node, final InternalSearchRequest request, final SearchServiceListener<QuerySearchResult> listener) { + public void sendExecuteQuery(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener<QuerySearchResult> listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QuerySearchResult result = searchService.executeQueryPhase(request); @@ -133,7 +133,7 @@ public void sendExecuteQuery(Node node, final InternalSearchRequest request, fin } } - public void sendExecuteQuery(Node node, final QuerySearchRequest request, final SearchServiceListener<QuerySearchResult> listener) { + public void sendExecuteQuery(DiscoveryNode node, final QuerySearchRequest request, final SearchServiceListener<QuerySearchResult> listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QuerySearchResult result = searchService.executeQueryPhase(request); @@ -163,7 +163,7 @@ public void sendExecuteQuery(Node node, final QuerySearchRequest request, final } } - public void sendExecuteQuery(Node node, final InternalScrollSearchRequest request, final SearchServiceListener<QuerySearchResult> listener) { + public void sendExecuteQuery(DiscoveryNode node, final InternalScrollSearchRequest request, final SearchServiceListener<QuerySearchResult> listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QuerySearchResult result = searchService.executeQueryPhase(request); @@ -193,7 +193,7 @@ public void sendExecuteQuery(Node node, final InternalScrollSearchRequest reques } } - public void sendExecuteFetch(Node node, final InternalSearchRequest request, final SearchServiceListener<QueryFetchSearchResult> listener) { + public void sendExecuteFetch(DiscoveryNode node, final InternalSearchRequest request, final SearchServiceListener<QueryFetchSearchResult> listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QueryFetchSearchResult result = searchService.executeFetchPhase(request); @@ -223,7 +223,7 @@ public void sendExecuteFetch(Node node, final InternalSearchRequest request, fin } } - public void sendExecuteFetch(Node node, final QuerySearchRequest request, final SearchServiceListener<QueryFetchSearchResult> listener) { + public void sendExecuteFetch(DiscoveryNode node, final QuerySearchRequest request, final SearchServiceListener<QueryFetchSearchResult> listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QueryFetchSearchResult result = searchService.executeFetchPhase(request); @@ -253,7 +253,7 @@ public void sendExecuteFetch(Node node, final QuerySearchRequest request, final } } - public void sendExecuteFetch(Node node, final InternalScrollSearchRequest request, final SearchServiceListener<QueryFetchSearchResult> listener) { + public void sendExecuteFetch(DiscoveryNode node, final InternalScrollSearchRequest request, final SearchServiceListener<QueryFetchSearchResult> listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { QueryFetchSearchResult result = searchService.executeFetchPhase(request); @@ -283,7 +283,7 @@ public void sendExecuteFetch(Node node, final InternalScrollSearchRequest reques } } - public void sendExecuteFetch(Node node, final FetchSearchRequest request, final SearchServiceListener<FetchSearchResult> listener) { + public void sendExecuteFetch(DiscoveryNode node, final FetchSearchRequest request, final SearchServiceListener<FetchSearchResult> listener) { if (clusterService.state().nodes().localNodeId().equals(node.id())) { try { FetchSearchResult result = searchService.executeFetchPhase(request); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ConnectTransportException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ConnectTransportException.java index 05a661db4294c..6b0abb69ec676 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ConnectTransportException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ConnectTransportException.java @@ -19,25 +19,25 @@ package org.elasticsearch.transport; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; /** * @author kimchy (Shay Banon) */ public class ConnectTransportException extends TransportException { - private final Node node; + private final DiscoveryNode node; - public ConnectTransportException(Node node, String msg) { + public ConnectTransportException(DiscoveryNode node, String msg) { this(node, msg, null); } - public ConnectTransportException(Node node, String msg, Throwable cause) { + public ConnectTransportException(DiscoveryNode node, String msg, Throwable cause) { super(node + ": " + msg, cause); this.node = node; } - public Node node() { + public DiscoveryNode node() { return node; } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/SendRequestTransportException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/SendRequestTransportException.java index 5d2c219ca1720..4159ea4dd264f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/SendRequestTransportException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/SendRequestTransportException.java @@ -19,14 +19,14 @@ package org.elasticsearch.transport; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; /** * @author kimchy (shay.banon) */ public class SendRequestTransportException extends RemoteTransportException { - public SendRequestTransportException(Node node, String action, Throwable cause) { + public SendRequestTransportException(DiscoveryNode node, String action, Throwable cause) { super(node.name(), node.address(), action, cause); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java index 272a7ec695d1e..bf1a4e65615be 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java @@ -19,7 +19,7 @@ package org.elasticsearch.transport; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.util.component.LifecycleComponent; import org.elasticsearch.util.io.stream.Streamable; import org.elasticsearch.util.transport.BoundTransportAddress; @@ -70,10 +70,10 @@ public static byte setError(byte value) { */ boolean addressSupported(Class<? extends TransportAddress> address); - void nodesAdded(Iterable<Node> nodes); + void nodesAdded(Iterable<DiscoveryNode> nodes); - void nodesRemoved(Iterable<Node> nodes); + void nodesRemoved(Iterable<DiscoveryNode> nodes); - <T extends Streamable> void sendRequest(Node node, long requestId, String action, + <T extends Streamable> void sendRequest(DiscoveryNode node, long requestId, String action, Streamable message, TransportResponseHandler<T> handler) throws IOException, TransportException; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java index 88ec72ae6548d..8fce3ea72783a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java @@ -21,7 +21,7 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.util.component.AbstractLifecycleComponent; import org.elasticsearch.util.concurrent.highscalelib.NonBlockingHashMapLong; @@ -96,7 +96,7 @@ public BoundTransportAddress boundAddress() { return transport.boundAddress(); } - public void nodesAdded(Iterable<Node> nodes) { + public void nodesAdded(Iterable<DiscoveryNode> nodes) { try { transport.nodesAdded(nodes); } catch (Exception e) { @@ -104,7 +104,7 @@ public void nodesAdded(Iterable<Node> nodes) { } } - public void nodesRemoved(Iterable<Node> nodes) { + public void nodesRemoved(Iterable<DiscoveryNode> nodes) { try { transport.nodesRemoved(nodes); } catch (Exception e) { @@ -123,14 +123,14 @@ public void throwConnectException(boolean throwConnectException) { this.throwConnectException = throwConnectException; } - public <T extends Streamable> TransportFuture<T> submitRequest(Node node, String action, Streamable message, + public <T extends Streamable> TransportFuture<T> submitRequest(DiscoveryNode node, String action, Streamable message, TransportResponseHandler<T> handler) throws TransportException { PlainTransportFuture<T> futureHandler = new PlainTransportFuture<T>(handler); sendRequest(node, action, message, futureHandler); return futureHandler; } - public <T extends Streamable> void sendRequest(final Node node, final String action, final Streamable message, + public <T extends Streamable> void sendRequest(final DiscoveryNode node, final String action, final Streamable message, final TransportResponseHandler<T> handler) throws TransportException { final long requestId = newRequestId(); try { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java index 7f3ed39437367..31a9e41c1d209 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java @@ -21,7 +21,7 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.Nullable; @@ -92,13 +92,13 @@ public LocalTransport(ThreadPool threadPool) { return boundAddress; } - @Override public void nodesAdded(Iterable<Node> nodes) { + @Override public void nodesAdded(Iterable<DiscoveryNode> nodes) { } - @Override public void nodesRemoved(Iterable<Node> nodes) { + @Override public void nodesRemoved(Iterable<DiscoveryNode> nodes) { } - @Override public <T extends Streamable> void sendRequest(final Node node, final long requestId, final String action, + @Override public <T extends Streamable> void sendRequest(final DiscoveryNode node, final long requestId, final String action, final Streamable message, final TransportResponseHandler<T> handler) throws IOException, TransportException { HandlesStreamOutput stream = BytesStreamOutput.Cached.cachedHandles(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java index 03820ff645e23..f11bcfbe9d805 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java @@ -23,7 +23,7 @@ import com.google.inject.Inject; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalStateException; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.SizeValue; @@ -355,7 +355,7 @@ TransportAddress wrapAddress(SocketAddress socketAddress) { private static final byte[] LENGTH_PLACEHOLDER = new byte[4]; - @Override public <T extends Streamable> void sendRequest(Node node, long requestId, String action, + @Override public <T extends Streamable> void sendRequest(DiscoveryNode node, long requestId, String action, Streamable streamable, final TransportResponseHandler<T> handler) throws IOException, TransportException { Channel targetChannel = nodeChannel(node); @@ -391,11 +391,11 @@ TransportAddress wrapAddress(SocketAddress socketAddress) { // }); } - @Override public void nodesAdded(Iterable<Node> nodes) { + @Override public void nodesAdded(Iterable<DiscoveryNode> nodes) { if (!lifecycle.started()) { throw new ElasticSearchIllegalStateException("Can't add nodes to a stopped transport"); } - for (Node node : nodes) { + for (DiscoveryNode node : nodes) { try { nodeChannel(node); } catch (Exception e) { @@ -404,8 +404,8 @@ TransportAddress wrapAddress(SocketAddress socketAddress) { } } - @Override public void nodesRemoved(Iterable<Node> nodes) { - for (Node node : nodes) { + @Override public void nodesRemoved(Iterable<DiscoveryNode> nodes) { + for (DiscoveryNode node : nodes) { NodeConnections nodeConnections = clientChannels.remove(node.id()); if (nodeConnections != null) { nodeConnections.close(); @@ -413,7 +413,7 @@ TransportAddress wrapAddress(SocketAddress socketAddress) { } } - private Channel nodeChannel(Node node) throws ConnectTransportException { + private Channel nodeChannel(DiscoveryNode node) throws ConnectTransportException { if (node == null) { throw new ConnectTransportException(node, "Can't connect to a null node"); } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardNoBackupsRoutingStrategyTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardNoBackupsRoutingStrategyTests.java index 62db40f7cf4cb..bae7350ea7bb5 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardNoBackupsRoutingStrategyTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardNoBackupsRoutingStrategyTests.java @@ -21,8 +21,8 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.MutableShardRouting; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.RoutingNodes; @@ -40,7 +40,7 @@ import static org.elasticsearch.cluster.ClusterState.*; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; import static org.elasticsearch.cluster.metadata.MetaData.*; -import static org.elasticsearch.cluster.node.Nodes.*; +import static org.elasticsearch.cluster.node.DiscoveryNodes.*; import static org.elasticsearch.cluster.routing.RoutingBuilders.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.hamcrest.MatcherAssert.*; @@ -231,8 +231,8 @@ public class SingleShardNoBackupsRoutingStrategyTests { } logger.info("Adding " + (numberOfIndices / 2) + " nodes"); - Nodes.Builder nodesBuilder = newNodesBuilder(); - List<Node> nodes = newArrayList(); + DiscoveryNodes.Builder nodesBuilder = newNodesBuilder(); + List<DiscoveryNode> nodes = newArrayList(); for (int i = 0; i < (numberOfIndices / 2); i++) { nodesBuilder.put(newNode("node" + i)); } @@ -436,7 +436,7 @@ public class SingleShardNoBackupsRoutingStrategyTests { } } - private Node newNode(String nodeId) { - return new Node(nodeId, DummyTransportAddress.INSTANCE); + private DiscoveryNode newNode(String nodeId) { + return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE); } } \ No newline at end of file diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardOneBackupRoutingStrategyTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardOneBackupRoutingStrategyTests.java index 24bc9e03399f5..5a804f9355a55 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardOneBackupRoutingStrategyTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/SingleShardOneBackupRoutingStrategyTests.java @@ -21,7 +21,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.util.logging.Loggers; @@ -32,7 +32,7 @@ import static org.elasticsearch.cluster.ClusterState.*; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; import static org.elasticsearch.cluster.metadata.MetaData.*; -import static org.elasticsearch.cluster.node.Nodes.*; +import static org.elasticsearch.cluster.node.DiscoveryNodes.*; import static org.elasticsearch.cluster.routing.RoutingBuilders.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.hamcrest.MatcherAssert.*; @@ -178,7 +178,7 @@ public class SingleShardOneBackupRoutingStrategyTests { assertThat(routingTable.index("test").shard(0).backupsShards().get(0).currentNodeId(), equalTo("node3")); } - private Node newNode(String nodeId) { - return new Node(nodeId, DummyTransportAddress.INSTANCE); + private DiscoveryNode newNode(String nodeId) { + return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE); } } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/TenShardsOneBackupRoutingTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/TenShardsOneBackupRoutingTests.java index b7abd607b93ff..0f374ec72211c 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/TenShardsOneBackupRoutingTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/routing/strategy/TenShardsOneBackupRoutingTests.java @@ -21,7 +21,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.util.logging.Loggers; @@ -32,7 +32,7 @@ import static org.elasticsearch.cluster.ClusterState.*; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; import static org.elasticsearch.cluster.metadata.MetaData.*; -import static org.elasticsearch.cluster.node.Nodes.*; +import static org.elasticsearch.cluster.node.DiscoveryNodes.*; import static org.elasticsearch.cluster.routing.RoutingBuilders.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.hamcrest.MatcherAssert.*; @@ -182,7 +182,7 @@ public class TenShardsOneBackupRoutingTests { assertThat(routingNodes.node("node3").numberOfShardsWithState(STARTED), equalTo(6)); } - private Node newNode(String nodeId) { - return new Node(nodeId, DummyTransportAddress.INSTANCE); + private DiscoveryNode newNode(String nodeId) { + return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE); } } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java index b360935cbaf74..b245dcb0b90a4 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java @@ -21,8 +21,8 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.node.Node; -import org.elasticsearch.cluster.node.Nodes; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.strategy.DefaultShardsRoutingStrategy; import org.elasticsearch.util.io.stream.BytesStreamInput; @@ -52,7 +52,7 @@ public class ClusterSerializationTests { .add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .build(); - Nodes nodes = Nodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).localNodeId("node1").masterNodeId("node2").build(); + DiscoveryNodes nodes = DiscoveryNodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).localNodeId("node1").masterNodeId("node2").build(); ClusterState clusterState = newClusterStateBuilder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); @@ -74,7 +74,7 @@ public class ClusterSerializationTests { .add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .build(); - Nodes nodes = Nodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).build(); + DiscoveryNodes nodes = DiscoveryNodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).build(); ClusterState clusterState = newClusterStateBuilder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); @@ -89,7 +89,7 @@ public class ClusterSerializationTests { assertThat(target.prettyPrint(), equalTo(source.prettyPrint())); } - private Node newNode(String nodeId) { - return new Node(nodeId, DummyTransportAddress.INSTANCE); + private DiscoveryNode newNode(String nodeId) { + return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE); } } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java index 8d8bc34b32a87..79e36daaf3ee0 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.transport.local; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.scaling.ScalingThreadPool; import org.elasticsearch.transport.*; @@ -41,17 +41,17 @@ public class SimpleLocalTransportTests { private TransportService serviceA; private TransportService serviceB; - private Node serviceANode; - private Node serviceBNode; + private DiscoveryNode serviceANode; + private DiscoveryNode serviceBNode; @BeforeClass public void setUp() { threadPool = new ScalingThreadPool(); serviceA = new TransportService(new LocalTransport(threadPool), threadPool).start(); - serviceANode = new Node("A", serviceA.boundAddress().publishAddress()); + serviceANode = new DiscoveryNode("A", serviceA.boundAddress().publishAddress()); serviceB = new TransportService(new LocalTransport(threadPool), threadPool).start(); - serviceBNode = new Node("B", serviceB.boundAddress().publishAddress()); + serviceBNode = new DiscoveryNode("B", serviceB.boundAddress().publishAddress()); } @AfterClass public void tearDown() { diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java index f238cc6c89147..c004b914165d8 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.transport.netty; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.scaling.ScalingThreadPool; import org.elasticsearch.transport.*; @@ -41,17 +41,17 @@ public class SimpleNettyTransportTests { private TransportService serviceA; private TransportService serviceB; - private Node serviceANode; - private Node serviceBNode; + private DiscoveryNode serviceANode; + private DiscoveryNode serviceBNode; @BeforeClass public void setUp() { threadPool = new ScalingThreadPool(); serviceA = new TransportService(new NettyTransport(threadPool), threadPool).start(); - serviceANode = new Node("A", serviceA.boundAddress().publishAddress()); + serviceANode = new DiscoveryNode("A", serviceA.boundAddress().publishAddress()); serviceB = new TransportService(new NettyTransport(threadPool), threadPool).start(); - serviceBNode = new Node("B", serviceB.boundAddress().publishAddress()); + serviceBNode = new DiscoveryNode("B", serviceB.boundAddress().publishAddress()); } @AfterClass public void tearDown() { diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java index ab8ad69f29876..b5fd824dbeddb 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java @@ -20,7 +20,7 @@ package org.elasticsearch.transport.netty.benchmark; import com.google.common.collect.Lists; -import org.elasticsearch.cluster.node.Node; +import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.cached.CachedThreadPool; import org.elasticsearch.transport.BaseTransportResponseHandler; @@ -60,7 +60,7 @@ public static void main(String[] args) { final ThreadPool threadPool = new CachedThreadPool(); final TransportService transportService = new TransportService(new NettyTransport(settings, threadPool), threadPool).start(); - final Node node = new Node("server", new InetSocketTransportAddress("localhost", 9999)); + final DiscoveryNode node = new DiscoveryNode("server", new InetSocketTransportAddress("localhost", 9999)); transportService.nodesAdded(Lists.newArrayList(node));
6cb4e7f20e242367f0efae50d3bb94a6ea989c0d
restlet-framework-java
- Upgraded Simple server to version 4.1.2.- Contributed by Niall Gallagher.--
p
https://github.com/restlet/restlet-framework-java
diff --git a/build/tmpl/text/changes.txt b/build/tmpl/text/changes.txt index 93b3f3fa20..64882b6ef3 100644 --- a/build/tmpl/text/changes.txt +++ b/build/tmpl/text/changes.txt @@ -20,7 +20,7 @@ Changes log community feed-back. - Added "roleMappings" property to Context. - Misc - - Upgraded Simple server to version 4.1.1. + - Upgraded Simple server to version 4.1.2. Contributed by Niall Gallagher. - 1.2 Milestone 1 (2009-01-23) diff --git a/libraries/org.simpleframework_4.1/org.simpleframework.jar b/libraries/org.simpleframework_4.1/org.simpleframework.jar index f7dc0870a5..72b44f4aa7 100644 Binary files a/libraries/org.simpleframework_4.1/org.simpleframework.jar and b/libraries/org.simpleframework_4.1/org.simpleframework.jar differ diff --git a/modules/org.restlet.ext.simple_4.1/src/org/restlet/ext/simple/SimpleCall.java b/modules/org.restlet.ext.simple_4.1/src/org/restlet/ext/simple/SimpleCall.java index 9a5dca8395..c3edcd96dd 100644 --- a/modules/org.restlet.ext.simple_4.1/src/org/restlet/ext/simple/SimpleCall.java +++ b/modules/org.restlet.ext.simple_4.1/src/org/restlet/ext/simple/SimpleCall.java @@ -69,7 +69,7 @@ public class SimpleCall extends HttpServerCall { /** Indicates if the request headers were parsed and added. */ private volatile boolean requestHeadersAdded; - + /** * The version of the request; */ @@ -97,15 +97,15 @@ public class SimpleCall extends HttpServerCall { setConfidential(confidential); this.requestHeadersAdded = false; } - + @Override protected boolean isClientKeepAlive() { - return request.isKeepAlive(); + return request.isKeepAlive(); } - + @Override protected long getContentLength() { - return request.getContentLength(); + return request.getContentLength(); } @Override @@ -120,12 +120,12 @@ public void complete() { @Override public String getHostDomain() { - return super.getHostDomain(); // FIXME + return super.getHostDomain(); // FIXME } - + @Override public String getClientAddress() { - return this.request.getClientAddress().getHostName(); + return this.request.getClientAddress().getAddress().getHostAddress(); } @Override @@ -175,11 +175,11 @@ public Series<Parameter> getRequestHeaders() { final Series<Parameter> result = super.getRequestHeaders(); if (!this.requestHeadersAdded) { - final List<String> names = this.request.getNames(); - - for(String name : names) { - result.add(new Parameter(name, this.request.getValue(name))); - } + final List<String> names = this.request.getNames(); + + for (String name : names) { + result.add(new Parameter(name, this.request.getValue(name))); + } this.requestHeadersAdded = true; } @@ -236,7 +236,7 @@ private SocketChannel getSocket() { return (SocketChannel) this.request .getAttribute(SimpleServer.PROPERTY_SOCKET); } - + /** * Returns the SSL engine. * @@ -287,7 +287,7 @@ public String getVersion() { @Override public void writeResponseHead(org.restlet.data.Response restletResponse) throws IOException { - //this.response.clear(); + // this.response.clear(); for (final Parameter header : getResponseHeaders()) { this.response.add(header.getName(), header.getValue()); }
2f3d64b70fbd92d4f3fe132bf0dd46a822ee14d6
drools
JBRULES-976: fixing problems with collections- clonning and adding unit tests--git-svn-id: https://svn.jboss.org/repos/labs/labs/jbossrules/trunk@13162 c60d74c8-e8f6-0310-9e8f-d4a2fc68ab70-
p
https://github.com/kiegroup/drools
diff --git a/drools-core/src/main/java/org/drools/util/ShadowProxyUtils.java b/drools-core/src/main/java/org/drools/util/ShadowProxyUtils.java index c9645536720..6ba4bb284ec 100644 --- a/drools-core/src/main/java/org/drools/util/ShadowProxyUtils.java +++ b/drools-core/src/main/java/org/drools/util/ShadowProxyUtils.java @@ -20,6 +20,7 @@ import java.lang.reflect.Array; import java.lang.reflect.Method; import java.util.Collection; +import java.util.Collections; import java.util.Map; /** @@ -29,6 +30,12 @@ */ public class ShadowProxyUtils { + /* Collections.UnmodifiableCollection is a package + * private class, thus the confusing bit above + * to get a Class to compare to. */ + private static final Class UNMODIFIABLE_MAP = Collections.unmodifiableMap( Collections.EMPTY_MAP ).getClass(); + private static final Class UNMODIFIABLE_COLLECTION = Collections.unmodifiableCollection( Collections.EMPTY_LIST ).getClass(); + private ShadowProxyUtils() { } @@ -41,24 +48,37 @@ public static Object cloneObject(Object original) { clone = cloneMethod.invoke( original, new Object[0] ); } catch ( Exception e ) { - // Nothing to do + /* Failed to clone. Don't worry about it, and just return + * the original object. */ } } if ( clone == null ) { try { - if ( original instanceof Map ) { + if ( original instanceof Map && + original != Collections.EMPTY_MAP && + !UNMODIFIABLE_MAP.isAssignableFrom( original.getClass() ) ) { + + /* empty and unmodifiable maps can't (and don't need to) be shadowed */ clone = original.getClass().newInstance(); ((Map) clone).putAll( (Map) original ); - } else if ( original instanceof Collection ) { + + } else if ( original instanceof Collection && + original != Collections.EMPTY_LIST && + original != Collections.EMPTY_SET && + !UNMODIFIABLE_COLLECTION.isAssignableFrom( original.getClass() ) ) { + + /* empty and unmodifiable collections can't (and don't need to) be shadowed */ clone = original.getClass().newInstance(); ((Collection) clone).addAll( (Collection) original ); + } else if ( original.getClass().isArray() ) { clone = cloneArray( original ); } + } catch ( Exception e ) { - e.printStackTrace(); - // nothing to do + /* Failed to clone. Don't worry about it, and just return + * the original object. */ } } @@ -85,10 +105,13 @@ public static Object cloneArray(Object original) { // cannot be invoked reflectively, so need to do copy construction: result = Array.newInstance( componentType, arrayLength ); - - if( componentType.isArray() ) { - for( int i = 0; i < arrayLength; i++ ) { - Array.set( result, i, cloneArray( Array.get( original, i ) ) ); + + if ( componentType.isArray() ) { + for ( int i = 0; i < arrayLength; i++ ) { + Array.set( result, + i, + cloneArray( Array.get( original, + i ) ) ); } } else { System.arraycopy( original, diff --git a/drools-core/src/test/java/org/drools/util/ShadowProxyUtilsTest.java b/drools-core/src/test/java/org/drools/util/ShadowProxyUtilsTest.java new file mode 100644 index 00000000000..47de0c7ab0a --- /dev/null +++ b/drools-core/src/test/java/org/drools/util/ShadowProxyUtilsTest.java @@ -0,0 +1,134 @@ +package org.drools.util; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import junit.framework.TestCase; + +public class ShadowProxyUtilsTest extends TestCase { + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void testCloneList() { + List list = new ArrayList(); + list.add( "a" ); + list.add( "b" ); + + List clone = (List) ShadowProxyUtils.cloneObject( list ); + assertEquals( list, + clone ); + assertNotSame( list, + clone ); + } + + public void testCloneMap() { + Map map = new TreeMap(); + map.put( "a", + "a" ); + map.put( "b", + "b" ); + + Map clone = (Map) ShadowProxyUtils.cloneObject( map ); + assertEquals( map, + clone ); + assertNotSame( map, + clone ); + } + + public void testCloneArray() { + int[][] array = new int[][]{{0, 0}, {0, 1}, {1, 0}, {1, 1}}; + + int[][] clone = (int[][]) ShadowProxyUtils.cloneObject( array ); + assertTrue( Arrays.deepEquals( array, + clone ) ); + assertNotSame( array, + clone ); + } + + public void testCloneUnmodifiableSet() { + Set set = new HashSet(); + set.add( "a" ); + set.add( "b" ); + + Set unmod = Collections.unmodifiableSet( set ); + + Set clone = (Set) ShadowProxyUtils.cloneObject( unmod ); + assertEquals( unmod, + clone ); + assertSame( unmod, + clone ); + } + + public void testCloneUnmodifiableMap() { + Map map = new TreeMap(); + map.put( "a", + "a" ); + map.put( "b", + "b" ); + Map unmod = Collections.unmodifiableMap( map ); + + Map clone = (Map) ShadowProxyUtils.cloneObject( unmod ); + assertEquals( unmod, + clone ); + assertSame( unmod, + clone ); + } + + public void testCloneEmptyList() { + List list = Collections.EMPTY_LIST; + + List clone = (List) ShadowProxyUtils.cloneObject( list ); + assertEquals( list, + clone ); + assertSame( list, + clone ); + } + + public void testCloneEmptySet() { + Set set = Collections.EMPTY_SET; + + Set clone = (Set) ShadowProxyUtils.cloneObject( set ); + assertEquals( set, + clone ); + assertSame( set, + clone ); + } + + public void testCloneEmptyMap() { + Map map = Collections.EMPTY_MAP; + + Map clone = (Map) ShadowProxyUtils.cloneObject( map ); + assertEquals( map, + clone ); + assertSame( map, + clone ); + } + + public void testCloneRegularObject() { + // this is never supposed to happen, + // but we don't want the method to blow up if it happens + Object obj = new Object(); + + Object clone = (Object) ShadowProxyUtils.cloneObject( obj ); + assertEquals( obj, + clone ); + assertSame( obj, + clone ); + + } + + + +}
65a5e2cc46b2c04591aa59b7a85751479a7dbd0b
hadoop
YARN-1936. Added security support for the Timeline- Client. Contributed by Zhijie Shen. svn merge --ignore-ancestry -c 1597153- ../../trunk/--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1597154 13f79535-47bb-0310-9956-ffa450edef68-
a
https://github.com/apache/hadoop
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 32c042622ceb3..02b922616b362 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -78,6 +78,9 @@ Release 2.5.0 - UNRELEASED YARN-2049. Added delegation-token support for the Timeline Server. (Zhijie Shen via vinodkv) + YARN-1936. Added security support for the Timeline Client. (Zhijie Shen via + vinodkv) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/TimelineClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/TimelineClient.java index a2ed3e70a51c9..de1d3e2ae53ff 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/TimelineClient.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/TimelineClient.java @@ -23,11 +23,13 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.security.token.Token; import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.yarn.api.records.timeline.TimelineEntity; import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse; import org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl; import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier; /** * A client library that can be used to post some information in terms of a @@ -65,4 +67,22 @@ protected TimelineClient(String name) { public abstract TimelinePutResponse putEntities( TimelineEntity... entities) throws IOException, YarnException; + /** + * <p> + * Get a delegation token so as to be able to talk to the timeline server in a + * secure way. + * </p> + * + * @param renewer + * Address of the renewer who can renew these tokens when needed by + * securely talking to the timeline server + * @return a delegation token ({@link Token}) that can be used to talk to the + * timeline server + * @throws IOException + * @throws YarnException + */ + @Public + public abstract Token<TimelineDelegationTokenIdentifier> getDelegationToken( + String renewer) throws IOException, YarnException; + } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java index 64cc041aaea54..5ffe17a24a6fb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java @@ -18,24 +18,43 @@ package org.apache.hadoop.yarn.client.api.impl; +import java.io.File; import java.io.IOException; +import java.net.HttpURLConnection; import java.net.URI; +import java.net.URL; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import javax.ws.rs.core.MediaType; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.GnuParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Options; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.security.authentication.client.AuthenticatedURL; +import org.apache.hadoop.security.authentication.client.AuthenticationException; +import org.apache.hadoop.security.token.Token; import org.apache.hadoop.yarn.api.records.timeline.TimelineEntities; import org.apache.hadoop.yarn.api.records.timeline.TimelineEntity; import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse; import org.apache.hadoop.yarn.client.api.TimelineClient; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; +import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier; +import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenSelector; +import org.apache.hadoop.yarn.util.timeline.TimelineUtils; import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider; +import org.codehaus.jackson.map.ObjectMapper; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; @@ -44,6 +63,8 @@ import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; +import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory; +import com.sun.jersey.client.urlconnection.URLConnectionClientHandler; @Private @Unstable @@ -52,16 +73,29 @@ public class TimelineClientImpl extends TimelineClient { private static final Log LOG = LogFactory.getLog(TimelineClientImpl.class); private static final String RESOURCE_URI_STR = "/ws/v1/timeline/"; private static final Joiner JOINER = Joiner.on(""); + private static Options opts; + static { + opts = new Options(); + opts.addOption("put", true, "Put the TimelineEntities in a JSON file"); + opts.getOption("put").setArgName("Path to the JSON file"); + opts.addOption("help", false, "Print usage"); + } private Client client; private URI resURI; private boolean isEnabled; + private TimelineAuthenticatedURLConnectionFactory urlFactory; public TimelineClientImpl() { super(TimelineClientImpl.class.getName()); ClientConfig cc = new DefaultClientConfig(); cc.getClasses().add(YarnJacksonJaxbJsonProvider.class); - client = Client.create(cc); + if (UserGroupInformation.isSecurityEnabled()) { + urlFactory = new TimelineAuthenticatedURLConnectionFactory(); + client = new Client(new URLConnectionClientHandler(urlFactory), cc); + } else { + client = Client.create(cc); + } } protected void serviceInit(Configuration conf) throws Exception { @@ -83,6 +117,9 @@ protected void serviceInit(Configuration conf) throws Exception { YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS), RESOURCE_URI_STR)); } + if (UserGroupInformation.isSecurityEnabled()) { + urlFactory.setService(TimelineUtils.buildTimelineTokenService(conf)); + } LOG.info("Timeline service address: " + resURI); } super.serviceInit(conf); @@ -124,6 +161,13 @@ public TimelinePutResponse putEntities( return resp.getEntity(TimelinePutResponse.class); } + @Override + public Token<TimelineDelegationTokenIdentifier> getDelegationToken( + String renewer) throws IOException, YarnException { + return TimelineAuthenticator.getDelegationToken(resURI.toURL(), + urlFactory.token, renewer); + } + @Private @VisibleForTesting public ClientResponse doPostingEntities(TimelineEntities entities) { @@ -133,4 +177,138 @@ public ClientResponse doPostingEntities(TimelineEntities entities) { .post(ClientResponse.class, entities); } + private static class TimelineAuthenticatedURLConnectionFactory + implements HttpURLConnectionFactory { + + private AuthenticatedURL.Token token; + private TimelineAuthenticator authenticator; + private Token<TimelineDelegationTokenIdentifier> dToken; + private Text service; + + public TimelineAuthenticatedURLConnectionFactory() { + token = new AuthenticatedURL.Token(); + authenticator = new TimelineAuthenticator(); + } + + @Override + public HttpURLConnection getHttpURLConnection(URL url) throws IOException { + try { + if (dToken == null) { + //TODO: need to take care of the renew case + dToken = selectToken(); + if (LOG.isDebugEnabled()) { + LOG.debug("Timeline delegation token: " + dToken.toString()); + } + } + if (dToken != null) { + Map<String, String> params = new HashMap<String, String>(); + TimelineAuthenticator.injectDelegationToken(params, dToken); + url = TimelineAuthenticator.appendParams(url, params); + if (LOG.isDebugEnabled()) { + LOG.debug("URL with delegation token: " + url); + } + } + return new AuthenticatedURL(authenticator).openConnection(url, token); + } catch (AuthenticationException e) { + LOG.error("Authentication failed when openning connection [" + url + + "] with token [" + token + "].", e); + throw new IOException(e); + } + } + + private Token<TimelineDelegationTokenIdentifier> selectToken() { + UserGroupInformation ugi; + try { + ugi = UserGroupInformation.getCurrentUser(); + } catch (IOException e) { + String msg = "Error when getting the current user"; + LOG.error(msg, e); + throw new YarnRuntimeException(msg, e); + } + TimelineDelegationTokenSelector tokenSelector = + new TimelineDelegationTokenSelector(); + return tokenSelector.selectToken( + service, ugi.getCredentials().getAllTokens()); + } + + public void setService(Text service) { + this.service = service; + } + + } + + public static void main(String[] argv) throws Exception { + CommandLine cliParser = new GnuParser().parse(opts, argv); + if (cliParser.hasOption("put")) { + String path = cliParser.getOptionValue("put"); + if (path != null && path.length() > 0) { + putTimelineEntitiesInJSONFile(path); + return; + } + } + printUsage(); + } + + /** + * Put timeline data in a JSON file via command line. + * + * @param path + * path to the {@link TimelineEntities} JSON file + */ + private static void putTimelineEntitiesInJSONFile(String path) { + File jsonFile = new File(path); + if (!jsonFile.exists()) { + System.out.println("Error: File [" + jsonFile.getAbsolutePath() + + "] doesn't exist"); + return; + } + ObjectMapper mapper = new ObjectMapper(); + YarnJacksonJaxbJsonProvider.configObjectMapper(mapper); + TimelineEntities entities = null; + try { + entities = mapper.readValue(jsonFile, TimelineEntities.class); + } catch (Exception e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(System.err); + return; + } + Configuration conf = new YarnConfiguration(); + TimelineClient client = TimelineClient.createTimelineClient(); + client.init(conf); + client.start(); + try { + if (UserGroupInformation.isSecurityEnabled() + && conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) { + Token<TimelineDelegationTokenIdentifier> token = + client.getDelegationToken( + UserGroupInformation.getCurrentUser().getUserName()); + UserGroupInformation.getCurrentUser().addToken(token); + } + TimelinePutResponse response = client.putEntities( + entities.getEntities().toArray( + new TimelineEntity[entities.getEntities().size()])); + if (response.getErrors().size() == 0) { + System.out.println("Timeline data is successfully put"); + } else { + for (TimelinePutResponse.TimelinePutError error : response.getErrors()) { + System.out.println("TimelineEntity [" + error.getEntityType() + ":" + + error.getEntityId() + "] is not successfully put. Error code: " + + error.getErrorCode()); + } + } + } catch (Exception e) { + System.err.println("Error: " + e.getMessage()); + e.printStackTrace(System.err); + } finally { + client.stop(); + } + } + + /** + * Helper function to print out usage + */ + private static void printUsage() { + new HelpFormatter().printHelp("TimelineClient", opts); + } + } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java index 8a0348b336842..f1a3b6eeceaf3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java @@ -19,6 +19,7 @@ package org.apache.hadoop.yarn.client.api.impl; import java.io.IOException; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; @@ -29,8 +30,13 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.DataInputByteBuffer; +import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.io.Text; import org.apache.hadoop.ipc.RPC; +import org.apache.hadoop.security.Credentials; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.hadoop.yarn.api.ApplicationClientProtocol; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse; @@ -64,6 +70,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.api.records.ContainerId; +import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.api.records.NodeReport; import org.apache.hadoop.yarn.api.records.NodeState; @@ -74,6 +81,7 @@ import org.apache.hadoop.yarn.api.records.YarnClusterMetrics; import org.apache.hadoop.yarn.client.ClientRMProxy; import org.apache.hadoop.yarn.client.api.AHSClient; +import org.apache.hadoop.yarn.client.api.TimelineClient; import org.apache.hadoop.yarn.client.api.YarnClient; import org.apache.hadoop.yarn.client.api.YarnClientApplication; import org.apache.hadoop.yarn.conf.YarnConfiguration; @@ -82,8 +90,10 @@ import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.security.AMRMTokenIdentifier; +import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier; import org.apache.hadoop.yarn.util.ConverterUtils; import org.apache.hadoop.yarn.util.Records; +import org.apache.hadoop.yarn.util.timeline.TimelineUtils; import com.google.common.annotations.VisibleForTesting; @@ -97,8 +107,11 @@ public class YarnClientImpl extends YarnClient { protected long submitPollIntervalMillis; private long asyncApiPollIntervalMillis; private long asyncApiPollTimeoutMillis; - protected AHSClient historyClient; + private AHSClient historyClient; private boolean historyServiceEnabled; + protected TimelineClient timelineClient; + protected Text timelineService; + protected boolean timelineServiceEnabled; private static final String ROOT = "root"; @@ -126,10 +139,17 @@ protected void serviceInit(Configuration conf) throws Exception { if (conf.getBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED, YarnConfiguration.DEFAULT_APPLICATION_HISTORY_ENABLED)) { historyServiceEnabled = true; - historyClient = AHSClientImpl.createAHSClient(); - historyClient.init(getConfig()); + historyClient = AHSClient.createAHSClient(); + historyClient.init(conf); } + if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, + YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { + timelineServiceEnabled = true; + timelineClient = TimelineClient.createTimelineClient(); + timelineClient.init(conf); + timelineService = TimelineUtils.buildTimelineTokenService(conf); + } super.serviceInit(conf); } @@ -141,6 +161,9 @@ protected void serviceStart() throws Exception { if (historyServiceEnabled) { historyClient.start(); } + if (timelineServiceEnabled) { + timelineClient.start(); + } } catch (IOException e) { throw new YarnRuntimeException(e); } @@ -155,6 +178,9 @@ protected void serviceStop() throws Exception { if (historyServiceEnabled) { historyClient.stop(); } + if (timelineServiceEnabled) { + timelineClient.stop(); + } super.serviceStop(); } @@ -189,6 +215,12 @@ public YarnClientApplication createApplication() Records.newRecord(SubmitApplicationRequest.class); request.setApplicationSubmissionContext(appContext); + // Automatically add the timeline DT into the CLC + // Only when the security and the timeline service are both enabled + if (isSecurityEnabled() && timelineServiceEnabled) { + addTimelineDelegationToken(appContext.getAMContainerSpec()); + } + //TODO: YARN-1763:Handle RM failovers during the submitApplication call. rmClient.submitApplication(request); @@ -238,6 +270,48 @@ public YarnClientApplication createApplication() return applicationId; } + private void addTimelineDelegationToken( + ContainerLaunchContext clc) throws YarnException, IOException { + org.apache.hadoop.security.token.Token<TimelineDelegationTokenIdentifier> timelineDelegationToken = + timelineClient.getDelegationToken( + UserGroupInformation.getCurrentUser().getUserName()); + if (timelineDelegationToken == null) { + return; + } + Credentials credentials = new Credentials(); + DataInputByteBuffer dibb = new DataInputByteBuffer(); + ByteBuffer tokens = clc.getTokens(); + if (tokens != null) { + dibb.reset(tokens); + credentials.readTokenStorageStream(dibb); + tokens.rewind(); + } + // If the timeline delegation token is already in the CLC, no need to add + // one more + for (org.apache.hadoop.security.token.Token<? extends TokenIdentifier> token : credentials + .getAllTokens()) { + TokenIdentifier tokenIdentifier = token.decodeIdentifier(); + if (tokenIdentifier instanceof TimelineDelegationTokenIdentifier) { + return; + } + } + credentials.addToken(timelineService, timelineDelegationToken); + if (LOG.isDebugEnabled()) { + LOG.debug("Add timline delegation token into credentials: " + + timelineDelegationToken); + } + DataOutputBuffer dob = new DataOutputBuffer(); + credentials.writeTokenStorageToStream(dob); + tokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); + clc.setTokens(tokens); + } + + @Private + @VisibleForTesting + protected boolean isSecurityEnabled() { + return UserGroupInformation.isSecurityEnabled(); + } + @Override public void killApplication(ApplicationId applicationId) throws YarnException, IOException { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java index cfee6f78d0c86..6407f7a1089e8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java @@ -25,19 +25,26 @@ import static org.mockito.Mockito.when; import java.io.IOException; +import java.nio.ByteBuffer; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; +import java.util.Collection; import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.junit.Assert; - import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.DataInputByteBuffer; +import org.apache.hadoop.io.DataOutputBuffer; +import org.apache.hadoop.security.Credentials; +import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod; +import org.apache.hadoop.security.token.Token; +import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.hadoop.yarn.api.ApplicationClientProtocol; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse; @@ -69,19 +76,23 @@ import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState; import org.apache.hadoop.yarn.api.records.YarnApplicationState; +import org.apache.hadoop.yarn.client.api.TimelineClient; import org.apache.hadoop.yarn.client.api.YarnClient; import org.apache.hadoop.yarn.client.api.YarnClientApplication; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.ApplicationIdNotProvidedException; import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier; import org.apache.hadoop.yarn.server.MiniYARNCluster; import org.apache.hadoop.yarn.server.resourcemanager.MockRM; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.util.Records; +import org.apache.hadoop.yarn.util.timeline.TimelineUtils; import org.apache.log4j.Level; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; +import org.junit.Assert; import org.junit.Test; public class TestYarnClient { @@ -725,4 +736,80 @@ private void testAsyncAPIPollTimeoutHelper(Long valueForTimeout, IOUtils.closeQuietly(client); } } + + @Test + public void testAutomaticTimelineDelegationTokenLoading() + throws Exception { + Configuration conf = new YarnConfiguration(); + conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true); + SecurityUtil.setAuthenticationMethod(AuthenticationMethod.KERBEROS, conf); + final Token<TimelineDelegationTokenIdentifier> dToken = + new Token<TimelineDelegationTokenIdentifier>(); + // crate a mock client + YarnClientImpl client = new YarnClientImpl() { + @Override + protected void serviceInit(Configuration conf) throws Exception { + if (getConfig().getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, + YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { + timelineServiceEnabled = true; + timelineClient = mock(TimelineClient.class); + when(timelineClient.getDelegationToken(any(String.class))) + .thenReturn(dToken); + timelineClient.init(getConfig()); + timelineService = TimelineUtils.buildTimelineTokenService(getConfig()); + } + this.setConfig(conf); + } + + @Override + protected void serviceStart() throws Exception { + rmClient = mock(ApplicationClientProtocol.class); + } + + @Override + protected void serviceStop() throws Exception { + } + + @Override + public ApplicationReport getApplicationReport(ApplicationId appId) { + ApplicationReport report = mock(ApplicationReport.class); + when(report.getYarnApplicationState()) + .thenReturn(YarnApplicationState.SUBMITTED); + return report; + } + + @Override + public boolean isSecurityEnabled() { + return true; + } + }; + client.init(conf); + client.start(); + ApplicationSubmissionContext context = + mock(ApplicationSubmissionContext.class); + ApplicationId applicationId = ApplicationId.newInstance(0, 1); + when(context.getApplicationId()).thenReturn(applicationId); + DataOutputBuffer dob = new DataOutputBuffer(); + Credentials credentials = new Credentials(); + credentials.writeTokenStorageToStream(dob); + ByteBuffer tokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); + ContainerLaunchContext clc = ContainerLaunchContext.newInstance( + null, null, null, null, tokens, null); + when(context.getAMContainerSpec()).thenReturn(clc); + client.submitApplication(context); + // Check whether token is added or not + credentials = new Credentials(); + DataInputByteBuffer dibb = new DataInputByteBuffer(); + tokens = clc.getTokens(); + if (tokens != null) { + dibb.reset(tokens); + credentials.readTokenStorageStream(dibb); + tokens.rewind(); + } + Collection<Token<? extends TokenIdentifier>> dTokens = + credentials.getAllTokens(); + Assert.assertEquals(1, dTokens.size()); + Assert.assertEquals(dToken, dTokens.iterator().next()); + client.stop(); + } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/timeline/TimelineUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/timeline/TimelineUtils.java index a62ed4869da47..02b5eb4eabdd9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/timeline/TimelineUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/timeline/TimelineUtils.java @@ -19,9 +19,14 @@ package org.apache.hadoop.yarn.util.timeline; import java.io.IOException; +import java.net.InetSocketAddress; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.security.SecurityUtil; +import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider; import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.map.JsonMappingException; @@ -78,4 +83,26 @@ public static String dumpTimelineRecordtoJSON(Object o, boolean pretty) } } + public static InetSocketAddress getTimelineTokenServiceAddress( + Configuration conf) { + InetSocketAddress timelineServiceAddr = null; + if (YarnConfiguration.useHttps(conf)) { + timelineServiceAddr = conf.getSocketAddr( + YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS, + YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS, + YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_PORT); + } else { + timelineServiceAddr = conf.getSocketAddr( + YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, + YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS, + YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_PORT); + } + return timelineServiceAddr; + } + + public static Text buildTimelineTokenService(Configuration conf) { + InetSocketAddress timelineServiceAddr = + getTimelineTokenServiceAddress(conf); + return SecurityUtil.buildTokenService(timelineServiceAddr); + } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/security/TimelineDelegationTokenSecretManagerService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/security/TimelineDelegationTokenSecretManagerService.java index fee9eb41cd80a..2808dac60dae6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/security/TimelineDelegationTokenSecretManagerService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/security/TimelineDelegationTokenSecretManagerService.java @@ -34,6 +34,7 @@ import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier; +import org.apache.hadoop.yarn.util.timeline.TimelineUtils; /** * The service wrapper of {@link TimelineDelegationTokenSecretManager} @@ -65,17 +66,7 @@ protected void serviceInit(Configuration conf) throws Exception { 3600000); secretManager.startThreads(); - if (YarnConfiguration.useHttps(getConfig())) { - serviceAddr = getConfig().getSocketAddr( - YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS, - YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS, - YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_PORT); - } else { - serviceAddr = getConfig().getSocketAddr( - YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, - YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS, - YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_PORT); - } + serviceAddr = TimelineUtils.getTimelineTokenServiceAddress(getConfig()); super.init(conf); }
a911e1da33ae86c2b30c34511b97f1a73bd681f8
drools
[JBRULES-3263] fix jitted contraints when invoking- an interface--
c
https://github.com/kiegroup/drools
diff --git a/drools-core/src/main/java/org/drools/rule/constraint/AnalyzedCondition.java b/drools-core/src/main/java/org/drools/rule/constraint/AnalyzedCondition.java index 0163a670464..6f41150939e 100644 --- a/drools-core/src/main/java/org/drools/rule/constraint/AnalyzedCondition.java +++ b/drools-core/src/main/java/org/drools/rule/constraint/AnalyzedCondition.java @@ -472,13 +472,19 @@ public MethodInvocation(Method method) { private Method getMethodFromSuperclass(Method method) { if (method == null) return method; - Class<?> declaringSuperclass = method.getDeclaringClass().getSuperclass(); - if (declaringSuperclass == null) return method; - try { - return getMethodFromSuperclass(declaringSuperclass.getMethod(method.getName(), method.getParameterTypes())); - } catch (Exception e) { - return method; + Class<?> declaringClass = method.getDeclaringClass(); + Class<?> declaringSuperclass = declaringClass.getSuperclass(); + if (declaringSuperclass != null) { + try { + return getMethodFromSuperclass(declaringSuperclass.getMethod(method.getName(), method.getParameterTypes())); + } catch (Exception e) { } } + for (Class<?> interfaze : declaringClass.getInterfaces()) { + try { + return interfaze.getMethod(method.getName(), method.getParameterTypes()); + } catch (Exception e) { } + } + return method; } public Method getMethod() {
1d54dde65fdeeba31a3a475cd13a23c2ae6cd2d4
drools
JBRULES-659: fixing the problem of multidimentional- arrays--git-svn-id: https://svn.jboss.org/repos/labs/labs/jbossrules/trunk@9457 c60d74c8-e8f6-0310-9e8f-d4a2fc68ab70-
c
https://github.com/kiegroup/drools
diff --git a/drools-core/src/main/java/org/codehaus/jfdi/interpreter/ClassTypeResolver.java b/drools-core/src/main/java/org/codehaus/jfdi/interpreter/ClassTypeResolver.java index 2c79505d51c..59049e2c0a3 100644 --- a/drools-core/src/main/java/org/codehaus/jfdi/interpreter/ClassTypeResolver.java +++ b/drools-core/src/main/java/org/codehaus/jfdi/interpreter/ClassTypeResolver.java @@ -1,283 +1,281 @@ -package org.codehaus.jfdi.interpreter; - -/* - * Copyright 2005 JBoss Inc - * - * 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. - */ - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class ClassTypeResolver - implements - TypeResolver { - private final List imports; - - private final ClassLoader classLoader; - - private Map cachedImports = new HashMap(); - - public ClassTypeResolver() { - this( Collections.EMPTY_LIST ); - } - - public ClassTypeResolver(final List imports) { - this( imports, - null ); - } - - public ClassTypeResolver(final List imports, - ClassLoader classLoader) { - this.imports = imports; - - if ( classLoader == null ) { - classLoader = Thread.currentThread().getContextClassLoader(); - } - - if ( classLoader == null ) { - classLoader = getClass().getClassLoader(); - } - - this.classLoader = classLoader; - } - - /* - * (non-Javadoc) - * - * @see org.drools.semantics.base.Importer#getImports( Class clazz ) - */ - /* (non-Javadoc) - * @see org.drools.semantics.java.TypeResolver#getImports() - */ - public List getImports() { - return this.imports; - } - - /* - * (non-Javadoc) - * - * @see org.drools.semantics.base.Importer#addImports(org.drools.spi.ImportEntry) - */ - /* (non-Javadoc) - * @see org.drools.semantics.java.TypeResolver#addImport(java.lang.String) - */ - public void addImport(final String importEntry) { - if ( !this.imports.contains( importEntry ) ) { - this.imports.add( importEntry ); - } - } - - public Class lookupFromCache(final String className) { - return (Class) this.cachedImports.get( className ); - } - - /* - * (non-Javadoc) - * - * @see org.drools.semantics.base.Importer#importClass(java.lang.ClassLoader, - * java.lang.String) - */ - /* (non-Javadoc) - * @see org.drools.semantics.java.TypeResolver#resolveType(java.lang.String) - */ - public Class resolveType(String className) throws ClassNotFoundException { - Class clazz = null; - boolean isArray = false; - - //is the class a primitive? - if ( "boolean".equals( className ) ) { - clazz = boolean.class; - } else if ( "byte".equals( className ) ) { - clazz = byte.class; - } else if ( "short".equals( className ) ) { - clazz = short.class; - } else if ( "char".equals( className ) ) { - clazz = char.class; - } else if ( "int".equals( className ) ) { - clazz = int.class; - } else if ( "long".equals( className ) ) { - clazz = long.class; - } else if ( "float".equals( className ) ) { - clazz = float.class; - } else if ( "double".equals( className ) ) { - clazz = double.class; - // Could also be a primitive array - } else if ( "boolean[]".equals( className ) ) { - clazz = boolean[].class; - } else if ( "byte[]".equals( className ) ) { - clazz = byte[].class; - } else if ( "short[]".equals( className ) ) { - clazz = short[].class; - } else if ( "char[]".equals( className ) ) { - clazz = char[].class; - } else if ( "int[]".equals( className ) ) { - clazz = int[].class; - } else if ( "long[]".equals( className ) ) { - clazz = long[].class; - } else if ( "float[]".equals( className ) ) { - clazz = float[].class; - } else if ( "double[]".equals( className ) ) { - clazz = double[].class; - // Could be primitive array of objects - } else if ( className.endsWith( "[]" ) ) { - String componentName = className.substring( 0, - className.length() - 2 ); - className = componentName; - isArray = true; - } - - if ( clazz == null ) { - // Now try the package object type cache - clazz = lookupFromCache( className ); - } - - // try loading className - if ( clazz == null ) { - try { - clazz = this.classLoader.loadClass( className ); - } catch ( final ClassNotFoundException e ) { - clazz = null; - } - } - - // Now try the className with each of the given imports - if ( clazz == null ) { - final Set validClazzCandidates = new HashSet(); - - final Iterator it = this.imports.iterator(); - while ( it.hasNext() ) { - clazz = importClass( (String) it.next(), - className ); - if ( clazz != null ) { - validClazzCandidates.add( clazz ); - } - } - - // If there are more than one possible resolutions, complain about - // the ambiguity - if ( validClazzCandidates.size() > 1 ) { - final StringBuffer sb = new StringBuffer(); - final Iterator clazzCandIter = validClazzCandidates.iterator(); - while ( clazzCandIter.hasNext() ) { - if ( 0 != sb.length() ) { - sb.append( ", " ); - } - sb.append( ((Class) clazzCandIter.next()).getName() ); - } - throw new Error( "Unable to find unambiguously defined class '" + className + "', candidates are: [" + sb.toString() + "]" ); - } else if ( validClazzCandidates.size() == 1 ) { - clazz = (Class) validClazzCandidates.toArray()[0]; - } else { - clazz = null; - } - - } - - // Now try the java.lang package - if ( clazz == null ) { - clazz = defaultClass( className ); - } - - // If array component class was found, try to resolve the array class of it - if( isArray && clazz != null ) { - String arrayClassName = new StringBuffer().append( "[L" ).append( clazz.getName() ).append( ";" ).toString(); - try { - clazz = Class.forName( arrayClassName ); - } catch ( ClassNotFoundException e ) { - clazz = null; - } - } - - // We still can't find the class so throw an exception - if ( clazz == null ) { - throw new ClassNotFoundException( "Unable to find class '" + className + "'" ); - } - - return clazz; - } - - private Class importClass(final String importText, - final String className) { - String qualifiedClass = null; - Class clazz = null; - - // not python - if ( importText.endsWith( "*" ) ) { - qualifiedClass = importText.substring( 0, - importText.indexOf( '*' ) ) + className; - } else if ( importText.endsWith( "." + className ) ) { - qualifiedClass = importText; - } else if ( importText.equals( className ) ) { - qualifiedClass = importText; - } - - if ( qualifiedClass != null ) { - try { - clazz = this.classLoader.loadClass( qualifiedClass ); - } catch ( final ClassNotFoundException e ) { - clazz = null; - } - - // maybe its a nested class? - if ( clazz == null ) { - try { - final int lastIndex = qualifiedClass.lastIndexOf( '.' ); - qualifiedClass = qualifiedClass.substring( 0, - lastIndex ) + "$" + qualifiedClass.substring( lastIndex + 1 ); - clazz = this.classLoader.loadClass( qualifiedClass ); - } catch ( final ClassNotFoundException e ) { - clazz = null; - } - } - } - - if ( clazz != null ) { - if ( this.cachedImports == Collections.EMPTY_MAP ) { - this.cachedImports = new HashMap(); - } - - this.cachedImports.put( className, - clazz ); - } - - return clazz; - } - - private Class defaultClass(String className) { - String qualifiedClass = "java.lang." + className; - Class clazz = null; - try { - clazz = this.classLoader.loadClass( qualifiedClass ); - } catch ( final ClassNotFoundException e ) { - // do nothing - } - if ( clazz != null ) { - if ( this.cachedImports == Collections.EMPTY_MAP ) { - this.cachedImports = new HashMap(); - } - this.cachedImports.put( className, - clazz ); - } - return clazz; - } - - public boolean isEmpty() { - return this.imports.isEmpty(); - } +package org.codehaus.jfdi.interpreter; + +/* + * Copyright 2005 JBoss Inc + * + * 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. + */ + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class ClassTypeResolver + implements + TypeResolver { + private final List imports; + + private final ClassLoader classLoader; + + private Map cachedImports = new HashMap(); + + private static Map internalNamesMap = new HashMap(); + static { + internalNamesMap.put( "int", "I" ); + internalNamesMap.put( "boolean", "Z" ); + internalNamesMap.put( "float", "F" ); + internalNamesMap.put( "long", "J" ); + internalNamesMap.put( "short", "S" ); + internalNamesMap.put( "byte", "B" ); + internalNamesMap.put( "double", "D" ); + internalNamesMap.put( "char", "C" ); + } + + public ClassTypeResolver() { + this( Collections.EMPTY_LIST ); + } + + public ClassTypeResolver(final List imports) { + this( imports, + null ); + } + + public ClassTypeResolver(final List imports, + ClassLoader classLoader) { + this.imports = imports; + + if ( classLoader == null ) { + classLoader = Thread.currentThread().getContextClassLoader(); + } + + if ( classLoader == null ) { + classLoader = getClass().getClassLoader(); + } + + this.classLoader = classLoader; + } + + /* + * (non-Javadoc) + * + * @see org.drools.semantics.base.Importer#getImports( Class clazz ) + */ + /* (non-Javadoc) + * @see org.drools.semantics.java.TypeResolver#getImports() + */ + public List getImports() { + return this.imports; + } + + /* + * (non-Javadoc) + * + * @see org.drools.semantics.base.Importer#addImports(org.drools.spi.ImportEntry) + */ + /* (non-Javadoc) + * @see org.drools.semantics.java.TypeResolver#addImport(java.lang.String) + */ + public void addImport(final String importEntry) { + if ( !this.imports.contains( importEntry ) ) { + this.imports.add( importEntry ); + } + } + + public Class lookupFromCache(final String className) { + return (Class) this.cachedImports.get( className ); + } + + /* + * (non-Javadoc) + * + * @see org.drools.semantics.base.Importer#importClass(java.lang.ClassLoader, + * java.lang.String) + */ + /* (non-Javadoc) + * @see org.drools.semantics.java.TypeResolver#resolveType(java.lang.String) + */ + public Class resolveType(String className) throws ClassNotFoundException { + Class clazz = null; + boolean isArray = false; + StringBuffer arrayClassName = new StringBuffer(); + + //is the class a primitive type ? + if (internalNamesMap.containsKey(className)) { + clazz = Class.forName( "[" + internalNamesMap.get(className), + true, + classLoader).getComponentType(); + // Could also be a primitive array + } else if ( className.indexOf('[') > 0 ) { + isArray = true; + int bracketIndex = className.indexOf('['); + String componentName = className.substring( 0, + bracketIndex ); + arrayClassName.append('['); + while( (bracketIndex = className.indexOf( '[', bracketIndex+1 )) > 0 ) { + arrayClassName.append('['); + } + className = componentName; + } + + if ( clazz == null ) { + // Now try the package object type cache + clazz = lookupFromCache( className ); + } + + // try loading className + if ( clazz == null ) { + try { + clazz = this.classLoader.loadClass( className ); + } catch ( final ClassNotFoundException e ) { + clazz = null; + } + } + + // Now try the className with each of the given imports + if ( clazz == null ) { + final Set validClazzCandidates = new HashSet(); + + final Iterator it = this.imports.iterator(); + while ( it.hasNext() ) { + clazz = importClass( (String) it.next(), + className ); + if ( clazz != null ) { + validClazzCandidates.add( clazz ); + } + } + + // If there are more than one possible resolutions, complain about + // the ambiguity + if ( validClazzCandidates.size() > 1 ) { + final StringBuffer sb = new StringBuffer(); + final Iterator clazzCandIter = validClazzCandidates.iterator(); + while ( clazzCandIter.hasNext() ) { + if ( 0 != sb.length() ) { + sb.append( ", " ); + } + sb.append( ((Class) clazzCandIter.next()).getName() ); + } + throw new Error( "Unable to find unambiguously defined class '" + className + "', candidates are: [" + sb.toString() + "]" ); + } else if ( validClazzCandidates.size() == 1 ) { + clazz = (Class) validClazzCandidates.toArray()[0]; + } else { + clazz = null; + } + + } + + // Now try the java.lang package + if ( clazz == null ) { + clazz = defaultClass( className ); + } + + // If array component class was found, try to resolve the array class of it + if( isArray ) { + if (clazz == null && internalNamesMap.containsKey( className ) ) { + arrayClassName.append( internalNamesMap.get( className ) ); + } else { + if( clazz != null ) { + arrayClassName.append( "L" ).append( clazz.getName() ).append( ";" ); + } else { + // we know we will probably not be able to resolve this name, but nothing else we can do. + arrayClassName.append( "L" ).append( className ).append( ";" ); + } + } + try { + clazz = Class.forName( arrayClassName.toString() ); + } catch ( ClassNotFoundException e ) { + clazz = null; + } + } + + // We still can't find the class so throw an exception + if ( clazz == null ) { + throw new ClassNotFoundException( "Unable to find class '" + className + "'" ); + } + + return clazz; + } + + private Class importClass(final String importText, + final String className) { + String qualifiedClass = null; + Class clazz = null; + + // not python + if ( importText.endsWith( "*" ) ) { + qualifiedClass = importText.substring( 0, + importText.indexOf( '*' ) ) + className; + } else if ( importText.endsWith( "." + className ) ) { + qualifiedClass = importText; + } else if ( importText.equals( className ) ) { + qualifiedClass = importText; + } + + if ( qualifiedClass != null ) { + try { + clazz = this.classLoader.loadClass( qualifiedClass ); + } catch ( final ClassNotFoundException e ) { + clazz = null; + } + + // maybe its a nested class? + if ( clazz == null ) { + try { + final int lastIndex = qualifiedClass.lastIndexOf( '.' ); + qualifiedClass = qualifiedClass.substring( 0, + lastIndex ) + "$" + qualifiedClass.substring( lastIndex + 1 ); + clazz = this.classLoader.loadClass( qualifiedClass ); + } catch ( final ClassNotFoundException e ) { + clazz = null; + } + } + } + + if ( clazz != null ) { + if ( this.cachedImports == Collections.EMPTY_MAP ) { + this.cachedImports = new HashMap(); + } + + this.cachedImports.put( className, + clazz ); + } + + return clazz; + } + + private Class defaultClass(String className) { + String qualifiedClass = "java.lang." + className; + Class clazz = null; + try { + clazz = this.classLoader.loadClass( qualifiedClass ); + } catch ( final ClassNotFoundException e ) { + // do nothing + } + if ( clazz != null ) { + if ( this.cachedImports == Collections.EMPTY_MAP ) { + this.cachedImports = new HashMap(); + } + this.cachedImports.put( className, + clazz ); + } + return clazz; + } + + public boolean isEmpty() { + return this.imports.isEmpty(); + } } \ No newline at end of file
5a57b334d860c19332f81e7b84947e452341a18c
camel
CAMEL-2970: JmsProducer supports non blocking- async routing engine for InOut Exchanges (request-reply over JMS).--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@978995 13f79535-47bb-0310-9956-ffa450edef68-
a
https://github.com/apache/camel
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java index 5b4520ea27d29..aad18b087e72b 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java @@ -67,7 +67,7 @@ public void onMessage(final Message message) { LOG.trace("onMessage START"); if (LOG.isDebugEnabled()) { - LOG.debug(endpoint + " consumer receiving JMS message: " + message); + LOG.debug(endpoint + " consumer received JMS message: " + message); } RuntimeCamelException rce = null; @@ -82,6 +82,12 @@ public void onMessage(final Message message) { if (LOG.isTraceEnabled()) { LOG.trace("onMessage.process START"); } + + String correlationId = message.getJMSCorrelationID(); + if (correlationId != null) { + LOG.debug("Received Message has JMSCorrelationID [" + correlationId + "]"); + } + processor.process(exchange); if (LOG.isTraceEnabled()) { LOG.trace("onMessage.process END"); @@ -292,19 +298,11 @@ protected void sendReply(String replyDestination, final Message message, final E getTemplate().send(replyDestination, new MessageCreator() { public Message createMessage(Session session) throws JMSException { Message reply = endpoint.getBinding().makeJmsMessage(exchange, out, session, cause); - - if (endpoint.getConfiguration().isUseMessageIDAsCorrelationID()) { - String messageID = exchange.getIn().getHeader("JMSMessageID", String.class); - reply.setJMSCorrelationID(messageID); - } else { - String correlationID = message.getJMSCorrelationID(); - if (correlationID != null) { - reply.setJMSCorrelationID(correlationID); - } - } + final String correlationID = determineCorrelationId(message); + reply.setJMSCorrelationID(correlationID); if (LOG.isDebugEnabled()) { - LOG.debug(endpoint + " sending reply JMS message: " + reply); + LOG.debug(endpoint + " sending reply JMS message [correlationId:" + correlationID + "]: " + reply); } return reply; } @@ -318,7 +316,9 @@ protected Object getReplyToDestination(Message message) throws JMSException { try { destination = message.getJMSReplyTo(); } catch (JMSException e) { - LOG.trace("Cannot read JMSReplyTo header. Will ignore this exception.", e); + if (LOG.isDebugEnabled()) { + LOG.debug("Cannot read JMSReplyTo header. Will ignore this exception.", e); + } } } return destination; diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java index 527848c35a5b5..bf965c1ecdf73 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java @@ -17,19 +17,16 @@ package org.apache.camel.component.jms; import java.util.Map; -import java.util.concurrent.ScheduledExecutorService; import javax.jms.ConnectionFactory; import javax.jms.ExceptionListener; import javax.jms.Session; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; -import org.apache.camel.component.jms.requestor.Requestor; import org.apache.camel.impl.DefaultComponent; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; import org.apache.camel.util.CastUtils; -import org.apache.camel.util.EndpointHelper; import org.apache.camel.util.ObjectHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -54,13 +51,10 @@ public class JmsComponent extends DefaultComponent implements ApplicationContextAware, HeaderFilterStrategyAware { private static final transient Log LOG = LogFactory.getLog(JmsComponent.class); - private static final int DEFAULT_THREADPOOL_SIZE = 100; private static final String DEFAULT_QUEUE_BROWSE_STRATEGY = "org.apache.camel.component.jms.DefaultQueueBrowseStrategy"; private static final String KEY_FORMAT_STRATEGY_PARAM = "jmsKeyFormatStrategy"; - private ScheduledExecutorService scheduledExecutorService; private JmsConfiguration configuration; private ApplicationContext applicationContext; - private Requestor requestor; private QueueBrowseStrategy queueBrowseStrategy; private boolean attemptedToCreateQueueBrowserStrategy; private HeaderFilterStrategy headerFilterStrategy = new JmsHeaderFilterStrategy(); @@ -341,30 +335,6 @@ public void setDestinationResolver(DestinationResolver destinationResolver) { getConfiguration().setDestinationResolver(destinationResolver); } - public synchronized Requestor getRequestor() throws Exception { - if (requestor == null) { - requestor = new Requestor(getConfiguration(), getScheduledExecutorService()); - requestor.start(); - } - return requestor; - } - - public void setRequestor(Requestor requestor) { - this.requestor = requestor; - } - - public synchronized ScheduledExecutorService getScheduledExecutorService() { - if (scheduledExecutorService == null) { - scheduledExecutorService = getCamelContext().getExecutorServiceStrategy() - .newScheduledThreadPool(this, "JmsComponent", DEFAULT_THREADPOOL_SIZE); - } - return scheduledExecutorService; - } - - public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService) { - this.scheduledExecutorService = scheduledExecutorService; - } - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } @@ -401,9 +371,6 @@ public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) { @Override protected void doStop() throws Exception { - if (requestor != null) { - requestor.stop(); - } super.doStop(); } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java index 0e5a91b81a408..dca332cd99a8f 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java @@ -124,12 +124,6 @@ public class JmsConfiguration implements Cloneable { private boolean useMessageIDAsCorrelationID; private JmsProviderMetadata providerMetadata = new JmsProviderMetadata(); private JmsOperations metadataJmsOperations; - // defines the component created temporary replyTo destination sharing strategy: - // possible values are: "component", "endpoint", "producer" - // component - a single temp queue is shared among all producers for a given component instance - // endpoint - a single temp queue is shared among all producers for a given endpoint instance - // producer - a single temp queue is created per producer - private String replyToTempDestinationAffinity = REPLYTO_TEMP_DEST_AFFINITY_PER_ENDPOINT; private String replyToDestination; private String replyToDestinationSelectorName; private JmsMessageType jmsMessageType; @@ -157,10 +151,6 @@ public JmsConfiguration copy() { } - public static interface MessageSentCallback { - void sent(Message message); - } - public static class CamelJmsTemplate extends JmsTemplate { private JmsConfiguration config; @@ -220,6 +210,9 @@ private Object doSendToDestination(final Destination destination, try { message = messageCreator.createMessage(session); doSend(producer, message); + if (message != null && callback != null) { + callback.sent(message, destination); + } // Check commit - avoid commit call within a JTA transaction. if (session.getTransacted() && isSessionLocallyTransacted(session)) { // Transacted session created by this template -> commit. @@ -228,9 +221,6 @@ private Object doSendToDestination(final Destination destination, } finally { JmsUtils.closeMessageProducer(producer); } - if (message != null && callback != null) { - callback.sent(message); - } return null; } @@ -349,6 +339,9 @@ private Object doSendToDestination(final Destination destination, logger.debug("Sending JMS message to: " + producer.getDestination() + " with message: " + message); } doSend(producer, message); + if (message != null && callback != null) { + callback.sent(message, destination); + } // Check commit - avoid commit call within a JTA transaction. if (session.getTransacted() && isSessionLocallyTransacted(session)) { // Transacted session created by this template -> commit. @@ -357,9 +350,6 @@ private Object doSendToDestination(final Destination destination, } finally { JmsUtils.closeMessageProducer(producer); } - if (message != null && callback != null) { - callback.sent(message); - } return null; } @@ -516,6 +506,7 @@ public AbstractMessageListenerContainer createMessageListenerContainer(JmsEndpoi // Properties // ------------------------------------------------------------------------- + public ConnectionFactory getConnectionFactory() { if (connectionFactory == null) { connectionFactory = createConnectionFactory(); @@ -863,10 +854,12 @@ public void setTransacted(boolean consumerTransacted) { * <p/> * By default this is false as you need to commit the outgoing request before you can consume the input */ + @Deprecated public boolean isTransactedInOut() { return transactedInOut; } + @Deprecated public void setTransactedInOut(boolean transactedInOut) { this.transactedInOut = transactedInOut; } @@ -1231,14 +1224,6 @@ public void setUseMessageIDAsCorrelationID(boolean useMessageIDAsCorrelationID) this.useMessageIDAsCorrelationID = useMessageIDAsCorrelationID; } - public String getReplyToTempDestinationAffinity() { - return replyToTempDestinationAffinity; - } - - public void setReplyToTempDestinationAffinity(String replyToTempDestinationAffinity) { - this.replyToTempDestinationAffinity = replyToTempDestinationAffinity; - } - public long getRequestTimeout() { return requestTimeout; } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java index b10e8ffb52c95..60397a75c1d1b 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java @@ -16,6 +16,10 @@ */ package org.apache.camel.component.jms; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ScheduledExecutorService; import javax.jms.ConnectionFactory; import javax.jms.Destination; @@ -32,12 +36,17 @@ import org.apache.camel.MultipleConsumersSupport; import org.apache.camel.PollingConsumer; import org.apache.camel.Processor; -import org.apache.camel.component.jms.requestor.Requestor; +import org.apache.camel.Service; +import org.apache.camel.component.jms.reply.PersistentQueueReplyManager; +import org.apache.camel.component.jms.reply.ReplyHolder; +import org.apache.camel.component.jms.reply.ReplyManager; +import org.apache.camel.component.jms.reply.TemporaryQueueReplyManager; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.impl.DefaultExchange; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; import org.apache.camel.spi.ManagementAware; +import org.apache.camel.util.ServiceHelper; import org.springframework.core.task.TaskExecutor; import org.springframework.jms.core.JmsOperations; import org.springframework.jms.listener.AbstractMessageListenerContainer; @@ -53,7 +62,7 @@ * @version $Revision:520964 $ */ @ManagedResource(description = "Managed JMS Endpoint") -public class JmsEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware, ManagementAware<JmsEndpoint>, MultipleConsumersSupport { +public class JmsEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware, ManagementAware<JmsEndpoint>, MultipleConsumersSupport, Service { private HeaderFilterStrategy headerFilterStrategy; private boolean pubSubDomain; private JmsBinding binding; @@ -61,8 +70,10 @@ public class JmsEndpoint extends DefaultEndpoint implements HeaderFilterStrategy private Destination destination; private String selector; private JmsConfiguration configuration; - private Requestor requestor; - private ScheduledExecutorService requestorExecutorService; + private final Map<String, ReplyManager> replyToReplyManager = new HashMap<String, ReplyManager>(); + private ReplyManager replyManager; + // scheduled executor to check for timeout (reply not received) + private ScheduledExecutorService replyManagerExecutorService; public JmsEndpoint() { this(null, null); @@ -284,16 +295,29 @@ public boolean isSingleton() { return true; } - public synchronized Requestor getRequestor() throws Exception { - if (requestor == null) { - requestor = new Requestor(getConfiguration(), getRequestorExecutorService()); - requestor.start(); + public synchronized ReplyManager getReplyManager() throws Exception { + if (replyManager == null) { + // use a temporary queue + replyManager = new TemporaryQueueReplyManager(); + replyManager.setEndpoint(this); + replyManager.setScheduledExecutorService(getReplyManagerExecutorService()); + ServiceHelper.startService(replyManager); } - return requestor; - } - - public void setRequestor(Requestor requestor) { - this.requestor = requestor; + return replyManager; + } + + public synchronized ReplyManager getReplyManager(String replyTo) throws Exception { + ReplyManager answer = replyToReplyManager.get(replyTo); + if (answer == null) { + // use a persistent queue + answer = new PersistentQueueReplyManager(); + answer.setEndpoint(this); + answer.setScheduledExecutorService(getReplyManagerExecutorService()); + ServiceHelper.startService(answer); + // remember this manager so we can re-use it + replyToReplyManager.put(replyTo, answer); + } + return answer; } public boolean isPubSubDomain() { @@ -343,11 +367,28 @@ protected JmsOperations getMetadataJmsOperations() { return template; } - protected synchronized ScheduledExecutorService getRequestorExecutorService() { - if (requestorExecutorService == null) { - requestorExecutorService = getCamelContext().getExecutorServiceStrategy().newScheduledThreadPool(this, "JmsRequesterTimeoutTask", 1); + protected synchronized ScheduledExecutorService getReplyManagerExecutorService() { + if (replyManagerExecutorService == null) { + replyManagerExecutorService = getCamelContext().getExecutorServiceStrategy().newScheduledThreadPool(this, "JmsReplyManagerTimeoutChecker", 1); + } + return replyManagerExecutorService; + } + + public void start() throws Exception { + } + + public void stop() throws Exception { + if (replyManager != null) { + ServiceHelper.stopService(replyManager); + replyManager = null; + } + + if (!replyToReplyManager.isEmpty()) { + for (ReplyManager replyManager : replyToReplyManager.values()) { + ServiceHelper.stopService(replyManager); + } + replyToReplyManager.clear(); } - return requestorExecutorService; } // Delegated properties from the configuration @@ -459,10 +500,6 @@ public String getReplyToDestinationSelectorName() { return getConfiguration().getReplyToDestinationSelectorName(); } - public String getReplyToTempDestinationAffinity() { - return getConfiguration().getReplyToTempDestinationAffinity(); - } - public long getRequestMapPurgePollTimeMillis() { return getConfiguration().getRequestMapPurgePollTimeMillis(); } @@ -768,10 +805,6 @@ public void setReplyToDestinationSelectorName(String replyToDestinationSelectorN getConfiguration().setReplyToDestinationSelectorName(replyToDestinationSelectorName); } - public void setReplyToTempDestinationAffinity(String replyToTempDestinationAffinity) { - getConfiguration().setReplyToTempDestinationAffinity(replyToTempDestinationAffinity); - } - public void setRequestMapPurgePollTimeMillis(long requestMapPurgePollTimeMillis) { getConfiguration().setRequestMapPurgePollTimeMillis(requestMapPurgePollTimeMillis); } @@ -911,4 +944,6 @@ protected String createEndpointUri() { return super.createEndpointUri(); } + + } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java index 438c62d561c7e..e39124f77574d 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java @@ -125,4 +125,19 @@ public static void setProperty(Message jmsMessage, String name, Object value) th } } + /** + * Sets the correlation id on the JMS message. + * <p/> + * Will ignore exception thrown + * + * @param message the JMS message + * @param correlationId the correlation id + */ + public static void setCorrelationId(Message message, String correlationId) { + try { + message.setJMSCorrelationID(correlationId); + } catch (JMSException e) { + // ignore + } + } } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java index d293949a9cc24..bf06deb6dfff4 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java @@ -16,11 +16,7 @@ */ package org.apache.camel.component.jms; -import java.util.concurrent.FutureTask; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; - import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; @@ -28,21 +24,19 @@ import org.apache.camel.AsyncCallback; import org.apache.camel.Exchange; -import org.apache.camel.ExchangeTimedOutException; import org.apache.camel.FailedToCreateProducerException; -import org.apache.camel.RuntimeCamelException; import org.apache.camel.RuntimeExchangeException; import org.apache.camel.component.jms.JmsConfiguration.CamelJmsTemplate; import org.apache.camel.component.jms.JmsConfiguration.CamelJmsTemplate102; -import org.apache.camel.component.jms.requestor.DeferredRequestReplyMap; -import org.apache.camel.component.jms.requestor.DeferredRequestReplyMap.DeferredMessageSentCallback; -import org.apache.camel.component.jms.requestor.PersistentReplyToRequestor; -import org.apache.camel.component.jms.requestor.Requestor; +import org.apache.camel.component.jms.reply.ReplyManager; +import org.apache.camel.component.jms.reply.UseMessageIdAsCorrelationIdMessageSentCallback; import org.apache.camel.impl.DefaultAsyncProducer; +import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.UuidGenerator; import org.apache.camel.util.ValueHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.jms.core.JmsOperations; import org.springframework.jms.core.MessageCreator; @@ -51,97 +45,46 @@ */ public class JmsProducer extends DefaultAsyncProducer { private static final transient Log LOG = LogFactory.getLog(JmsProducer.class); - private RequestorAffinity affinity; private final JmsEndpoint endpoint; + private final AtomicBoolean started = new AtomicBoolean(false); private JmsOperations inOnlyTemplate; private JmsOperations inOutTemplate; private UuidGenerator uuidGenerator; - private DeferredRequestReplyMap deferredRequestReplyMap; - private Requestor requestor; - private AtomicBoolean started = new AtomicBoolean(false); - - private enum RequestorAffinity { - PER_COMPONENT(0), - PER_ENDPOINT(1), - PER_PRODUCER(2); - private int value; - private RequestorAffinity(int value) { - this.value = value; - } - } + private ReplyManager replyManager; public JmsProducer(JmsEndpoint endpoint) { super(endpoint); this.endpoint = endpoint; - JmsConfiguration c = endpoint.getConfiguration(); - affinity = RequestorAffinity.PER_PRODUCER; - if (c.getReplyTo() != null) { - if (c.getReplyToTempDestinationAffinity().equals(JmsConfiguration.REPLYTO_TEMP_DEST_AFFINITY_PER_ENDPOINT)) { - affinity = RequestorAffinity.PER_ENDPOINT; - } else if (c.getReplyToTempDestinationAffinity().equals(JmsConfiguration.REPLYTO_TEMP_DEST_AFFINITY_PER_COMPONENT)) { - affinity = RequestorAffinity.PER_COMPONENT; - } - } - } - - public long getRequestTimeout() { - return endpoint.getConfiguration().getRequestTimeout(); } - protected void doStart() throws Exception { - super.doStart(); - } - - protected void testAndSetRequestor() throws RuntimeCamelException { + protected void initReplyManager() { if (!started.get()) { synchronized (this) { if (started.get()) { return; } try { - JmsConfiguration c = endpoint.getConfiguration(); - if (c.getReplyTo() != null) { - requestor = new PersistentReplyToRequestor(endpoint.getConfiguration(), endpoint.getRequestorExecutorService()); - requestor.start(); + if (endpoint.getReplyTo() != null) { + replyManager = endpoint.getReplyManager(endpoint.getReplyTo()); + if (LOG.isInfoEnabled()) { + LOG.info("Using JmsReplyManager: " + replyManager + " to process replies from: " + endpoint.getReplyTo() + + " queue with " + endpoint.getConcurrentConsumers() + " concurrent consumers."); + } } else { - if (affinity == RequestorAffinity.PER_PRODUCER) { - requestor = new Requestor(endpoint.getConfiguration(), endpoint.getRequestorExecutorService()); - requestor.start(); - } else if (affinity == RequestorAffinity.PER_ENDPOINT) { - requestor = endpoint.getRequestor(); - } else if (affinity == RequestorAffinity.PER_COMPONENT) { - requestor = ((JmsComponent)endpoint.getComponent()).getRequestor(); + replyManager = endpoint.getReplyManager(); + if (LOG.isInfoEnabled()) { + LOG.info("Using JmsReplyManager: " + replyManager + " to process replies from temporary queue with " + + endpoint.getConcurrentConsumers() + " concurrent consumers."); } } } catch (Exception e) { throw new FailedToCreateProducerException(endpoint, e); } - deferredRequestReplyMap = requestor.getDeferredRequestReplyMap(this); started.set(true); } } } - protected void testAndUnsetRequestor() throws Exception { - if (started.get()) { - synchronized (this) { - if (!started.get()) { - return; - } - requestor.removeDeferredRequestReplyMap(this); - if (affinity == RequestorAffinity.PER_PRODUCER) { - requestor.stop(); - } - started.set(false); - } - } - } - - protected void doStop() throws Exception { - testAndUnsetRequestor(); - super.doStop(); - } - public boolean process(Exchange exchange, AsyncCallback callback) { if (!endpoint.isDisableReplyTo() && exchange.getPattern().isOutCapable()) { // in out requires a bit more work than in only @@ -173,111 +116,76 @@ protected boolean processInOut(final Exchange exchange, final AsyncCallback call destinationName = null; } - testAndSetRequestor(); + initReplyManager(); // note due to JMS transaction semantics we cannot use a single transaction // for sending the request and receiving the response - final Destination replyTo = requestor.getReplyTo(); - + final Destination replyTo = replyManager.getReplyTo(); if (replyTo == null) { throw new RuntimeExchangeException("Failed to resolve replyTo destination", exchange); } + // when using message id as correlation id, we need at first to use a provisional correlation id + // which we then update to the real JMSMessageID when the message has been sent + // this is done with the help of the MessageSentCallback final boolean msgIdAsCorrId = endpoint.getConfiguration().isUseMessageIDAsCorrelationID(); - String correlationId = in.getHeader("JMSCorrelationID", String.class); + final String provisionalCorrelationId = msgIdAsCorrId ? getUuidGenerator().generateUuid() : null; + MessageSentCallback messageSentCallback = null; + if (msgIdAsCorrId) { + messageSentCallback = new UseMessageIdAsCorrelationIdMessageSentCallback(replyManager, provisionalCorrelationId, endpoint.getRequestTimeout()); + } + final ValueHolder<MessageSentCallback> sentCallback = new ValueHolder<MessageSentCallback>(messageSentCallback); - if (correlationId == null && !msgIdAsCorrId) { + final String originalCorrelationId = in.getHeader("JMSCorrelationID", String.class); + if (originalCorrelationId == null && !msgIdAsCorrId) { in.setHeader("JMSCorrelationID", getUuidGenerator().generateUuid()); } - final ValueHolder<FutureTask> futureHolder = new ValueHolder<FutureTask>(); - final DeferredMessageSentCallback jmsCallback = msgIdAsCorrId ? deferredRequestReplyMap.createDeferredMessageSentCallback() : null; - MessageCreator messageCreator = new MessageCreator() { public Message createMessage(Session session) throws JMSException { Message message = endpoint.getBinding().makeJmsMessage(exchange, in, session, null); message.setJMSReplyTo(replyTo); - requestor.setReplyToSelectorHeader(in, message); + replyManager.setReplyToSelectorHeader(in, message); - FutureTask future; - future = (!msgIdAsCorrId) - ? requestor.getReceiveFuture(message.getJMSCorrelationID(), endpoint.getConfiguration().getRequestTimeout()) - : requestor.getReceiveFuture(jmsCallback); + String correlationId = determineCorrelationId(message, provisionalCorrelationId); + replyManager.registerReply(replyManager, exchange, callback, originalCorrelationId, correlationId, endpoint.getRequestTimeout()); - futureHolder.set(future); return message; } }; - doSend(true, destinationName, destination, messageCreator, jmsCallback); + doSend(true, destinationName, destination, messageCreator, sentCallback.get()); // after sending then set the OUT message id to the JMSMessageID so its identical setMessageId(exchange); - // now we should routing asynchronously to not block while waiting for the reply - // TODO: - // we need a thread pool to use for continue routing messages, just like a seda consumer - // and we need options to configure it as well so you can indicate how many threads to use - // TODO: Also consider requestTimeout - - // lets wait and return the response - long requestTimeout = endpoint.getConfiguration().getRequestTimeout(); - try { - Message message = null; - try { - if (LOG.isDebugEnabled()) { - LOG.debug("Message sent, now waiting for reply at: " + replyTo.toString()); - } - if (requestTimeout <= 0) { - message = (Message)futureHolder.get().get(); - } else { - message = (Message)futureHolder.get().get(requestTimeout, TimeUnit.MILLISECONDS); - } - } catch (InterruptedException e) { - if (LOG.isDebugEnabled()) { - LOG.debug("Future interrupted: " + e, e); - } - } catch (TimeoutException e) { - if (LOG.isDebugEnabled()) { - LOG.debug("Future timed out: " + e, e); - } - } - if (message != null) { - // the response can be an exception - JmsMessage response = new JmsMessage(message, endpoint.getBinding()); - Object body = response.getBody(); - - if (endpoint.isTransferException() && body instanceof Exception) { - if (LOG.isDebugEnabled()) { - LOG.debug("Reply received. Setting reply as an Exception: " + body); - } - // we got an exception back and endpoint was configured to transfer exception - // therefore set response as exception - exchange.setException((Exception) body); - } else { - if (LOG.isDebugEnabled()) { - LOG.debug("Reply received. Setting reply as OUT message: " + body); - } - // regular response - exchange.setOut(response); - } + // continue routing asynchronously (reply will be processed async when its received) + return false; + } - // restore correlation id in case the remote server messed with it - if (correlationId != null) { - message.setJMSCorrelationID(correlationId); - exchange.getOut().setHeader("JMSCorrelationID", correlationId); - } - } else { - // no response, so lets set a timed out exception - exchange.setException(new ExchangeTimedOutException(exchange, requestTimeout)); - } - } catch (Exception e) { - exchange.setException(e); + /** + * Strategy to determine which correlation id to use among <tt>JMSMessageID</tt> and <tt>JMSCorrelationID</tt>. + * + * @param message the JMS message + * @param provisionalCorrelationId an optional provisional correlation id, which is preferred to be used + * @return the correlation id to use + * @throws JMSException can be thrown + */ + protected String determineCorrelationId(Message message, String provisionalCorrelationId) throws JMSException { + if (provisionalCorrelationId != null) { + return provisionalCorrelationId; } - // TODO: should be async - callback.done(true); - return true; + final String messageId = message.getJMSMessageID(); + final String correlationId = message.getJMSCorrelationID(); + if (endpoint.getConfiguration().isUseMessageIDAsCorrelationID()) { + return messageId; + } else if (ObjectHelper.isEmpty(correlationId)) { + // correlation id is empty so fallback to message id + return messageId; + } else { + return correlationId; + } } protected boolean processInOnly(final Exchange exchange, final AsyncCallback callback) { @@ -340,14 +248,14 @@ public Message createMessage(Session session) throws JMSException { /** * Sends the message using the JmsTemplate. * - * @param inOut use inOut or inOnly template + * @param inOut use inOut or inOnly template * @param destinationName the destination name * @param destination the destination (if no name provided) - * @param messageCreator the creator to create the javax.jms.Message to send + * @param messageCreator the creator to create the {@link Message} to send * @param callback optional callback for inOut messages */ protected void doSend(boolean inOut, String destinationName, Destination destination, - MessageCreator messageCreator, DeferredMessageSentCallback callback) { + MessageCreator messageCreator, MessageSentCallback callback) { CamelJmsTemplate template = null; CamelJmsTemplate102 template102 = null; @@ -405,7 +313,7 @@ protected void setMessageId(Exchange exchange) { } } catch (JMSException e) { LOG.warn("Unable to retrieve JMSMessageID from outgoing " - + "JMS Message and set it into Camel's MessageId", e); + + "JMS Message and set it into Camel's MessageId", e); } } } @@ -433,9 +341,6 @@ public void setInOutTemplate(JmsOperations inOutTemplate) { } public UuidGenerator getUuidGenerator() { - if (uuidGenerator == null) { - uuidGenerator = UuidGenerator.get(); - } return uuidGenerator; } @@ -443,4 +348,16 @@ public void setUuidGenerator(UuidGenerator uuidGenerator) { this.uuidGenerator = uuidGenerator; } + protected void doStart() throws Exception { + super.doStart(); + if (uuidGenerator == null) { + // use the default generator + uuidGenerator = UuidGenerator.get(); + } + } + + protected void doStop() throws Exception { + super.doStop(); + } + } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/ReplyHandler.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/MessageSentCallback.java similarity index 71% rename from components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/ReplyHandler.java rename to components/camel-jms/src/main/java/org/apache/camel/component/jms/MessageSentCallback.java index c40579f3c321d..c2739a2cd16c7 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/ReplyHandler.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/MessageSentCallback.java @@ -14,18 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.component.jms.requestor; +package org.apache.camel.component.jms; -import javax.jms.JMSException; +import javax.jms.Destination; import javax.jms.Message; /** + * Callback when a {@link Message} has been sent. + * * @version $Revision$ */ -public interface ReplyHandler { +public interface MessageSentCallback { + /** - * Processes the message, returning true if this is the last method of a lifecycle - * so that the handler can be discarded + * Callback when the message has been sent. + * + * @param message the message + * @param destination the destination */ - boolean handle(Message message) throws JMSException; + void sent(Message message, Destination destination); } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/CorrelationMap.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/CorrelationMap.java new file mode 100644 index 0000000000000..2fa218ae849f7 --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/CorrelationMap.java @@ -0,0 +1,39 @@ +/** + * 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.apache.camel.component.jms.reply; + +import java.util.concurrent.ScheduledExecutorService; + +import org.apache.camel.util.DefaultTimeoutMap; + +/** + * @version $Revision$ + */ +public class CorrelationMap extends DefaultTimeoutMap<String, ReplyHandler> { + + public CorrelationMap(ScheduledExecutorService executor, long requestMapPollTimeMillis) { + super(executor, requestMapPollTimeMillis); + } + + public boolean onEviction(String key, ReplyHandler value) { + // trigger timeout + value.onTimeout(key); + // return true to remove the element + return true; + } + +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/MessageSelectorProvider.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java similarity index 64% rename from components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/MessageSelectorProvider.java rename to components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java index 873a6524bffa9..cf5f5ed23705b 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/MessageSelectorProvider.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java @@ -14,17 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.component.jms.requestor; +package org.apache.camel.component.jms.reply; import java.util.HashMap; import java.util.Map; -public class MessageSelectorProvider { +/** + * A creator which can build the JMS message selector query string to use + * with a shared persistent reply-to queue, so we can select the correct messages we expect as replies. + */ +public class MessageSelectorCreator { protected Map<String, String> correlationIds; protected boolean dirty = true; protected StringBuilder expression; - public MessageSelectorProvider() { + public MessageSelectorCreator() { correlationIds = new HashMap<String, String>(); } @@ -42,18 +46,27 @@ public synchronized String get() { if (!dirty) { return expression.toString(); } + expression = new StringBuilder("JMSCorrelationID='"); - boolean first = true; - for (Map.Entry<String, String> entry : correlationIds.entrySet()) { - if (!first) { - expression.append(" OR JMSCorrelationID='"); - } - expression.append(entry.getValue()).append("'"); - if (first) { - first = false; + + if (correlationIds.isEmpty()) { + // no id's so use a dummy to select nothing + expression.append("CamelDummyJmsMessageSelector'"); + } else { + boolean first = true; + for (Map.Entry<String, String> entry : correlationIds.entrySet()) { + if (!first) { + expression.append(" OR JMSCorrelationID='"); + } + expression.append(entry.getValue()).append("'"); + if (first) { + first = false; + } } } + dirty = false; return expression.toString(); } -} + +} \ No newline at end of file diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyHandler.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyHandler.java new file mode 100644 index 0000000000000..e29fe00a41e4d --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyHandler.java @@ -0,0 +1,56 @@ +/** + * 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.apache.camel.component.jms.reply; + +import javax.jms.Message; + +import org.apache.camel.AsyncCallback; +import org.apache.camel.Exchange; + +/** + * {@link ReplyHandler} to handle processing replies when using persistent queues. + * + * @version $Revision$ + */ +public class PersistentQueueReplyHandler extends TemporaryQueueReplyHandler { + + private MessageSelectorCreator dynamicMessageSelector; + + public PersistentQueueReplyHandler(ReplyManager replyManager, Exchange exchange, AsyncCallback callback, + String originalCorrelationId, long timeout, MessageSelectorCreator dynamicMessageSelector) { + super(replyManager, exchange, callback, originalCorrelationId, timeout); + this.dynamicMessageSelector = dynamicMessageSelector; + } + + @Override + public void onReply(String correlationId, Message reply) { + if (dynamicMessageSelector != null) { + // remove correlation id from message selector + dynamicMessageSelector.removeCorrelationID(correlationId); + } + super.onReply(correlationId, reply); + } + + @Override + public void onTimeout(String correlationId) { + if (dynamicMessageSelector != null) { + // remove correlation id from message selector + dynamicMessageSelector.removeCorrelationID(correlationId); + } + super.onTimeout(correlationId); + } +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java new file mode 100644 index 0000000000000..7f6da3f0e9492 --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java @@ -0,0 +1,239 @@ +/** + * 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.apache.camel.component.jms.reply; + +import java.math.BigInteger; +import java.util.Random; +import javax.jms.Destination; +import javax.jms.ExceptionListener; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.Session; + +import org.apache.camel.AsyncCallback; +import org.apache.camel.Exchange; +import org.springframework.core.task.TaskExecutor; +import org.springframework.jms.listener.AbstractMessageListenerContainer; +import org.springframework.jms.listener.DefaultMessageListenerContainer; +import org.springframework.jms.support.destination.DestinationResolver; +import org.springframework.transaction.PlatformTransactionManager; + +/** + * A {@link ReplyManager} when using persistent queues. + * + * @version $Revision$ + */ +public class PersistentQueueReplyManager extends ReplyManagerSupport { + + private String replyToSelectorValue; + private MessageSelectorCreator dynamicMessageSelector; + + public String registerReply(ReplyManager replyManager, Exchange exchange, AsyncCallback callback, + String originalCorrelationId, String correlationId, long requestTimeout) { + // add to correlation map + PersistentQueueReplyHandler handler = new PersistentQueueReplyHandler(replyManager, exchange, callback, + originalCorrelationId, requestTimeout, dynamicMessageSelector); + correlation.put(correlationId, handler, requestTimeout); + if (dynamicMessageSelector != null) { + // also remember to keep the dynamic selector updated with the new correlation id + dynamicMessageSelector.addCorrelationID(correlationId); + } + return correlationId; + } + + public void updateCorrelationId(String correlationId, String newCorrelationId, long requestTimeout) { + if (log.isTraceEnabled()) { + log.trace("Updated provisional correlationId [" + correlationId + "] to expected correlationId [" + newCorrelationId + "]"); + } + + ReplyHandler handler = correlation.remove(correlationId); + if (handler == null) { + // should not happen that we can't find the handler + return; + } + + correlation.put(newCorrelationId, handler, requestTimeout); + + // no not arrived early + if (dynamicMessageSelector != null) { + // also remember to keep the dynamic selector updated with the new correlation id + dynamicMessageSelector.addCorrelationID(newCorrelationId); + } + } + + protected void handleReplyMessage(String correlationID, Message message) { + ReplyHandler handler = correlation.get(correlationID); + if (handler == null && endpoint.isUseMessageIDAsCorrelationID()) { + handler = waitForProvisionCorrelationToBeUpdated(correlationID, message); + } + + if (handler != null) { + try { + handler.onReply(correlationID, message); + } finally { + if (dynamicMessageSelector != null) { + // also remember to keep the dynamic selector updated with the new correlation id + dynamicMessageSelector.removeCorrelationID(correlationID); + } + correlation.remove(correlationID); + } + } else { + // we could not correlate the received reply message to a matching request and therefore + // we cannot continue routing the unknown message + String text = "Reply received for unknown correlationID [" + correlationID + "] -> " + message; + log.warn(text); + throw new UnknownReplyMessageException(text, message, correlationID); + } + } + + public void setReplyToSelectorHeader(org.apache.camel.Message camelMessage, Message jmsMessage) throws JMSException { + String replyToSelectorName = endpoint.getReplyToDestinationSelectorName(); + if (replyToSelectorName != null && replyToSelectorValue != null) { + camelMessage.setHeader(replyToSelectorName, replyToSelectorValue); + jmsMessage.setStringProperty(replyToSelectorName, replyToSelectorValue); + } + } + + private final class DestinationResolverDelegate implements DestinationResolver { + private DestinationResolver delegate; + private Destination destination; + + public DestinationResolverDelegate(DestinationResolver delegate) { + this.delegate = delegate; + } + + public Destination resolveDestinationName(Session session, String destinationName, + boolean pubSubDomain) throws JMSException { + synchronized (PersistentQueueReplyManager.this) { + try { + // resolve the reply to destination + if (destination == null) { + destination = delegate.resolveDestinationName(session, destinationName, pubSubDomain); + setReplyTo(destination); + } + } finally { + PersistentQueueReplyManager.this.notifyAll(); + } + } + return destination; + } + }; + + private final class PersistentQueueMessageListenerContainer extends DefaultMessageListenerContainer { + + private String fixedMessageSelector; + private MessageSelectorCreator creator; + + private PersistentQueueMessageListenerContainer(String fixedMessageSelector) { + this.fixedMessageSelector = fixedMessageSelector; + } + + private PersistentQueueMessageListenerContainer(MessageSelectorCreator creator) { + this.creator = creator; + } + + @Override + public String getMessageSelector() { + String id = null; + if (fixedMessageSelector != null) { + id = fixedMessageSelector; + } else if (creator != null) { + id = creator.get(); + } + if (log.isTraceEnabled()) { + log.trace("Using MessageSelector[" + id + "]"); + } + return id; + } + } + + protected AbstractMessageListenerContainer createListenerContainer() throws Exception { + DefaultMessageListenerContainer answer; + + String replyToSelectorName = endpoint.getReplyToDestinationSelectorName(); + if (replyToSelectorName != null) { + // 24 max char is what IBM WebSphereMQ supports in CorrelationIDs + // use a fixed selector name so we can select the replies which is intended for us + replyToSelectorValue = "ID:" + new BigInteger(24 * 8, new Random()).toString(16); + String fixedMessageSelector = replyToSelectorName + "='" + replyToSelectorValue + "'"; + answer = new PersistentQueueMessageListenerContainer(fixedMessageSelector); + } else { + // use a dynamic message selector which will select the message we want to receive as reply + dynamicMessageSelector = new MessageSelectorCreator(); + answer = new PersistentQueueMessageListenerContainer(dynamicMessageSelector); + } + + answer.setConnectionFactory(endpoint.getListenerConnectionFactory()); + DestinationResolver resolver = endpoint.getDestinationResolver(); + if (resolver == null) { + resolver = answer.getDestinationResolver(); + } + answer.setDestinationResolver(new DestinationResolverDelegate(resolver)); + answer.setDestinationName(endpoint.getReplyTo()); + + answer.setAutoStartup(true); + answer.setMessageListener(this); + answer.setPubSubDomain(false); + answer.setSubscriptionDurable(false); + answer.setConcurrentConsumers(endpoint.getConcurrentConsumers()); + + ExceptionListener exceptionListener = endpoint.getExceptionListener(); + if (exceptionListener != null) { + answer.setExceptionListener(exceptionListener); + } + + answer.setSessionTransacted(endpoint.isTransacted()); + if (endpoint.isTransacted()) { + answer.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED); + } else { + if (endpoint.getAcknowledgementMode() >= 0) { + answer.setSessionAcknowledgeMode(endpoint.getAcknowledgementMode()); + } else if (endpoint.getAcknowledgementModeName() != null) { + answer.setSessionAcknowledgeModeName(endpoint.getAcknowledgementModeName()); + } + } + + answer.setConcurrentConsumers(1); + answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_SESSION); + + if (endpoint.getReceiveTimeout() >= 0) { + answer.setReceiveTimeout(endpoint.getReceiveTimeout()); + } + if (endpoint.getRecoveryInterval() >= 0) { + answer.setRecoveryInterval(endpoint.getRecoveryInterval()); + } + TaskExecutor taskExecutor = endpoint.getTaskExecutor(); + if (taskExecutor != null) { + answer.setTaskExecutor(taskExecutor); + } + PlatformTransactionManager tm = endpoint.getTransactionManager(); + if (tm != null) { + answer.setTransactionManager(tm); + } else if (endpoint.isTransacted()) { + throw new IllegalArgumentException("Property transacted is enabled but a transactionManager was not injected!"); + } + if (endpoint.getTransactionName() != null) { + answer.setTransactionName(endpoint.getTransactionName()); + } + if (endpoint.getTransactionTimeout() >= 0) { + answer.setTransactionTimeout(endpoint.getTransactionTimeout()); + } + + return answer; + } + +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/FailedToProcessResponse.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyHandler.java similarity index 58% rename from components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/FailedToProcessResponse.java rename to components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyHandler.java index e14ee3f29978e..424dec01088e0 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/FailedToProcessResponse.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyHandler.java @@ -14,30 +14,29 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.component.jms.requestor; +package org.apache.camel.component.jms.reply; -import javax.jms.JMSException; import javax.jms.Message; -import org.apache.camel.RuntimeCamelException; - /** - * An exception thrown if a response message from an InOut could not be processed + * Handles a reply. * * @version $Revision$ */ -public class FailedToProcessResponse extends RuntimeCamelException { - private final Message response; +public interface ReplyHandler { - public FailedToProcessResponse(Message response, JMSException e) { - super("Failed to process response: " + e + ". Message: " + response, e); - this.response = response; - } + /** + * The reply message was received + * + * @param correlationId the correlation id + * @param reply the reply message + */ + void onReply(String correlationId, Message reply); /** - * The response message which caused the exception + * The reply message was not received and a timeout triggered + * + * @param correlationId the correlation id */ - public Message getResponse() { - return response; - } + void onTimeout(String correlationId); } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyHolder.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyHolder.java new file mode 100644 index 0000000000000..4386ff6f69092 --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyHolder.java @@ -0,0 +1,100 @@ +/** + * 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.apache.camel.component.jms.reply; + +import javax.jms.Message; + +import org.apache.camel.AsyncCallback; +import org.apache.camel.Exchange; + +/** + * Holder which contains the {@link Exchange} and {@link org.apache.camel.AsyncCallback} to be used + * when the reply arrives, so we can set the reply on the {@link Exchange} and continue routing using the callback. + * + * @version $Revision$ + */ +public class ReplyHolder { + + private final Exchange exchange; + private final AsyncCallback callback; + private final Message message; + private final String originalCorrelationId; + private long timeout; + + /** + * Constructor to use when a reply message was received + */ + public ReplyHolder(Exchange exchange, AsyncCallback callback, String originalCorrelationId, Message message) { + this.exchange = exchange; + this.callback = callback; + this.originalCorrelationId = originalCorrelationId; + this.message = message; + } + + /** + * Constructor to use when a timeout occurred + */ + public ReplyHolder(Exchange exchange, AsyncCallback callback, String originalCorrelationId, long timeout) { + this(exchange, callback, originalCorrelationId, null); + this.timeout = timeout; + } + + public Exchange getExchange() { + return exchange; + } + + public AsyncCallback getCallback() { + return callback; + } + + /** + * Gets the original correlation id, if one was set when sending the message. + * <p/> + * Some JMS brokers will mess with the correlation id and send back a different/empty correlation id. + * So we need to remember it so we can restore the correlation id. + */ + public String getOriginalCorrelationId() { + return originalCorrelationId; + } + + /** + * Gets the received message + * + * @return the received message, or <tt>null</tt> if timeout occurred and no message has been received + * @see #isTimeout() + */ + public Message getMessage() { + return message; + } + + /** + * Whether timeout triggered or not. + * <p/> + * A timeout is triggered if <tt>requestTimeout</tt> option has been configured, and a reply message has <b>not</b> been + * received within that time frame. + */ + public boolean isTimeout() { + return message == null; + } + + /** + * The timeout value + */ + public long getRequestTimeout() { + return timeout; + } +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManager.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManager.java new file mode 100644 index 0000000000000..9156ac5d47359 --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManager.java @@ -0,0 +1,98 @@ +/** + * 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.apache.camel.component.jms.reply; + +import java.util.concurrent.ScheduledExecutorService; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; + +import org.apache.camel.AsyncCallback; +import org.apache.camel.Exchange; +import org.apache.camel.component.jms.JmsEndpoint; + +/** + * The {@link ReplyManager} is responsible for handling <a href="http://camel.apache.org/request-reply.html">request-reply</a> + * over JMS. + * + * @version $Revision$ + */ +public interface ReplyManager extends MessageListener { + + /** + * Sets the belonging {@link org.apache.camel.component.jms.JmsEndpoint}. + */ + void setEndpoint(JmsEndpoint endpoint); + + /** + * Sets the reply to queue the manager should listen for replies. + * <p/> + * The queue is either a temporary or a persistent queue. + */ + void setReplyTo(Destination replyTo); + + /** + * Sets the scheduled to use when checking for timeouts (no reply received within a given time period) + */ + void setScheduledExecutorService(ScheduledExecutorService executorService); + + /** + * Gets the reply to queue being used + */ + Destination getReplyTo(); + + /** + * To be used when a persistent reply queue is used with a custom JMS selector is being used. + */ + void setReplyToSelectorHeader(org.apache.camel.Message camelMessage, Message jmsMessage) throws JMSException; + + /** + * Register a reply + * + * @param replyManager the reply manager being used + * @param exchange the exchange + * @param callback the callback + * @param originalCorrelationId an optional original correlation id + * @param correlationId the correlation id to expect being used + * @param requestTimeout an optional timeout + * @return the correlation id used + */ + String registerReply(ReplyManager replyManager, Exchange exchange, AsyncCallback callback, + String originalCorrelationId, String correlationId, long requestTimeout); + + /** + * Updates the correlation id to the new correlation id. + * <p/> + * This is only used when <tt>useMessageIDasCorrelationID</tt> option is used, which means a + * provisional correlation id is first used, then after the message has been sent, the real + * correlation id is known. This allows us then to update the internal mapping to expect the + * real correlation id. + * + * @param correlationId the provisional correlation id + * @param newCorrelationId the real correlation id + * @param requestTimeout an optional timeout + */ + void updateCorrelationId(String correlationId, String newCorrelationId, long requestTimeout); + + /** + * Process the reply + * + * @param holder containing needed data to process the reply and continue routing + */ + void processReply(ReplyHolder holder); +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java new file mode 100644 index 0000000000000..7f542aba6e460 --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java @@ -0,0 +1,217 @@ +/** + * 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.apache.camel.component.jms.reply; + +import java.util.concurrent.ScheduledExecutorService; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; + +import org.apache.camel.AsyncCallback; +import org.apache.camel.Exchange; +import org.apache.camel.ExchangeTimedOutException; +import org.apache.camel.component.jms.JmsEndpoint; +import org.apache.camel.component.jms.JmsMessage; +import org.apache.camel.component.jms.JmsMessageHelper; +import org.apache.camel.impl.ServiceSupport; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.ServiceHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.jms.listener.AbstractMessageListenerContainer; + +/** + * Base class for {@link ReplyManager} implementations. + * + * @version $Revision$ + */ +public abstract class ReplyManagerSupport extends ServiceSupport implements ReplyManager { + + protected final Log log = LogFactory.getLog(getClass()); + protected ScheduledExecutorService executorService; + protected JmsEndpoint endpoint; + protected Destination replyTo; + protected AbstractMessageListenerContainer listenerContainer; + protected long replyToResolverTimeout = 5000; + protected CorrelationMap correlation; + + public void setScheduledExecutorService(ScheduledExecutorService executorService) { + this.executorService = executorService; + } + + public void setEndpoint(JmsEndpoint endpoint) { + this.endpoint = endpoint; + } + + public void setReplyTo(Destination replyTo) { + if (log.isTraceEnabled()) { + log.trace("ReplyTo destination: " + replyTo); + } + this.replyTo = replyTo; + } + + public Destination getReplyTo() { + synchronized (this) { + try { + // wait for the reply to destination to be resolved + if (replyTo == null) { + wait(replyToResolverTimeout); + } + } catch (Throwable e) { + // ignore + } + } + return replyTo; + } + + public void onMessage(Message message) { + String correlationID = null; + try { + correlationID = message.getJMSCorrelationID(); + } catch (JMSException e) { + // ignore + } + if (correlationID == null) { + log.warn("Ignoring message with no correlationID: " + message); + return; + } + + if (log.isDebugEnabled()) { + log.debug("Received reply message with correlationID: " + correlationID + " -> " + message); + } + + // handle the reply message + handleReplyMessage(correlationID, message); + } + + public void processReply(ReplyHolder holder) { + if (holder != null && isRunAllowed()) { + Exchange exchange = holder.getExchange(); + Message message = holder.getMessage(); + + boolean timeout = holder.isTimeout(); + if (timeout) { + // no response, so lets set a timed out exception + exchange.setException(new ExchangeTimedOutException(exchange, holder.getRequestTimeout())); + } else { + JmsMessage response = new JmsMessage(message, endpoint.getBinding()); + Object body = response.getBody(); + + if (endpoint.isTransferException() && body instanceof Exception) { + if (log.isDebugEnabled()) { + log.debug("Reply received. Setting reply as an Exception: " + body); + } + // we got an exception back and endpoint was configured to transfer exception + // therefore set response as exception + exchange.setException((Exception) body); + } else { + if (log.isDebugEnabled()) { + log.debug("Reply received. Setting reply as OUT message: " + body); + } + // regular response + exchange.setOut(response); + } + + // restore correlation id in case the remote server messed with it + if (holder.getOriginalCorrelationId() != null) { + JmsMessageHelper.setCorrelationId(message, holder.getOriginalCorrelationId()); + exchange.getOut().setHeader("JMSCorrelationID", holder.getOriginalCorrelationId()); + } + } + + // notify callback + AsyncCallback callback = holder.getCallback(); + callback.done(false); + } + } + + protected abstract void handleReplyMessage(String correlationID, Message message); + + protected abstract AbstractMessageListenerContainer createListenerContainer() throws Exception; + + /** + * <b>IMPORTANT:</b> This logic is only being used due to high performance in-memory only + * testing using InOut over JMS. Its unlikely to happen in a real life situation with communication + * to a remote broker, which always will be slower to send back reply, before Camel had a chance + * to update it's internal correlation map. + */ + protected ReplyHandler waitForProvisionCorrelationToBeUpdated(String correlationID, Message message) { + // race condition, when using messageID as correlationID then we store a provisional correlation id + // at first, which gets updated with the JMSMessageID after the message has been sent. And in the unlikely + // event that the reply comes back really really fast, and the correlation map hasn't yet been updated + // from the provisional id to the JMSMessageID. If so we have to wait a bit and lookup again. + if (log.isWarnEnabled()) { + log.warn("Early reply received with correlationID [" + correlationID + "] -> " + message); + } + + ReplyHandler answer = null; + + // wait up till 5 seconds + boolean done = false; + int counter = 0; + while (!done && counter++ < 50) { + if (log.isTraceEnabled()) { + log.trace("Early reply not found handler at attempt " + counter + ". Waiting a bit longer."); + } + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // ignore + } + + // try again + answer = correlation.get(correlationID); + done = answer != null; + + if (answer != null) { + if (log.isTraceEnabled()) { + log.trace("Early reply with correlationID [" + correlationID + "] has been matched after " + + counter + " attempts and can be processed using handler: " + answer); + } + } + } + + return answer; + } + + @Override + protected void doStart() throws Exception { + ObjectHelper.notNull(executorService, "executorService", this); + ObjectHelper.notNull(endpoint, "endpoint", this); + + // purge for timeout every second + correlation = new CorrelationMap(executorService, 1000); + ServiceHelper.startService(correlation); + + // create JMS listener and start it + listenerContainer = createListenerContainer(); + listenerContainer.afterPropertiesSet(); + listenerContainer.start(); + } + + @Override + protected void doStop() throws Exception { + ServiceHelper.stopService(correlation); + + if (listenerContainer != null) { + listenerContainer.stop(); + listenerContainer.destroy(); + listenerContainer = null; + } + } + +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyHandler.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyHandler.java new file mode 100644 index 0000000000000..b5c02ed3aac1a --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyHandler.java @@ -0,0 +1,62 @@ +/** + * 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.apache.camel.component.jms.reply; + +import javax.jms.Message; + +import org.apache.camel.AsyncCallback; +import org.apache.camel.Exchange; + +/** + * {@link ReplyHandler} to handle processing replies when using temporary queues. + * + * @version $Revision$ + */ +public class TemporaryQueueReplyHandler implements ReplyHandler { + + // task queue to add the holder so we can process the reply + protected final ReplyManager replyManager; + protected final Exchange exchange; + protected final AsyncCallback callback; + // remember the original correlation id, in case the server returns back a reply with a messed up correlation id + protected final String originalCorrelationId; + protected final long timeout; + + public TemporaryQueueReplyHandler(ReplyManager replyManager, Exchange exchange, AsyncCallback callback, + String originalCorrelationId, long timeout) { + this.replyManager = replyManager; + this.exchange = exchange; + this.originalCorrelationId = originalCorrelationId; + this.callback = callback; + this.timeout = timeout; + } + + public void onReply(String correlationId, Message reply) { + // create holder object with the reply and add to task queue so we can process the reply and continue + // route the exchange using the async routing engine + ReplyHolder holder = new ReplyHolder(exchange, callback, originalCorrelationId, reply); + // process reply + replyManager.processReply(holder); + } + + public void onTimeout(String correlationId) { + // create holder object without the reply which means a timeout occurred + ReplyHolder holder = new ReplyHolder(exchange, callback, originalCorrelationId, timeout); + // process timeout + replyManager.processReply(holder); + } +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java new file mode 100644 index 0000000000000..225ff631f9d2b --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java @@ -0,0 +1,126 @@ +/** + * 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.apache.camel.component.jms.reply; + +import javax.jms.Destination; +import javax.jms.ExceptionListener; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.Session; +import javax.jms.TemporaryQueue; + +import org.apache.camel.AsyncCallback; +import org.apache.camel.Exchange; +import org.springframework.core.task.TaskExecutor; +import org.springframework.jms.listener.AbstractMessageListenerContainer; +import org.springframework.jms.listener.SimpleMessageListenerContainer; +import org.springframework.jms.support.destination.DestinationResolver; + +/** + * A {@link ReplyManager} when using temporary queues. + * + * @version $Revision$ + */ +public class TemporaryQueueReplyManager extends ReplyManagerSupport { + + public String registerReply(ReplyManager replyManager, Exchange exchange, AsyncCallback callback, + String originalCorrelationId, String correlationId, long requestTimeout) { + // add to correlation map + TemporaryQueueReplyHandler handler = new TemporaryQueueReplyHandler(this, exchange, callback, originalCorrelationId, requestTimeout); + correlation.put(correlationId, handler, requestTimeout); + return correlationId; + } + + public void updateCorrelationId(String correlationId, String newCorrelationId, long requestTimeout) { + if (log.isTraceEnabled()) { + log.trace("Updated provisional correlationId [" + correlationId + "] to expected correlationId [" + newCorrelationId + "]"); + } + + ReplyHandler handler = correlation.remove(correlationId); + correlation.put(newCorrelationId, handler, requestTimeout); + } + + @Override + protected void handleReplyMessage(String correlationID, Message message) { + ReplyHandler handler = correlation.get(correlationID); + if (handler == null && endpoint.isUseMessageIDAsCorrelationID()) { + handler = waitForProvisionCorrelationToBeUpdated(correlationID, message); + } + + if (handler != null) { + try { + handler.onReply(correlationID, message); + } finally { + correlation.remove(correlationID); + } + } else { + // we could not correlate the received reply message to a matching request and therefore + // we cannot continue routing the unknown message + String text = "Reply received for unknown correlationID [" + correlationID + "] -> " + message; + log.warn(text); + throw new UnknownReplyMessageException(text, message, correlationID); + } + } + + public void setReplyToSelectorHeader(org.apache.camel.Message camelMessage, Message jmsMessage) throws JMSException { + // noop + } + + @Override + protected AbstractMessageListenerContainer createListenerContainer() throws Exception { + SimpleMessageListenerContainer answer = new SimpleMessageListenerContainer(); + + answer.setDestinationName("temporary"); + answer.setDestinationResolver(new DestinationResolver() { + public Destination resolveDestinationName(Session session, String destinationName, + boolean pubSubDomain) throws JMSException { + // use a temporary queue to gather the reply message + TemporaryQueue queue = null; + synchronized (TemporaryQueueReplyManager.this) { + try { + queue = session.createTemporaryQueue(); + setReplyTo(queue); + } finally { + TemporaryQueueReplyManager.this.notifyAll(); + } + } + return queue; + } + }); + answer.setAutoStartup(true); + answer.setMessageListener(this); + answer.setPubSubDomain(false); + answer.setSubscriptionDurable(false); + answer.setConcurrentConsumers(endpoint.getConcurrentConsumers()); + answer.setConnectionFactory(endpoint.getConnectionFactory()); + String clientId = endpoint.getClientId(); + if (clientId != null) { + clientId += ".CamelReplyManager"; + answer.setClientId(clientId); + } + TaskExecutor taskExecutor = endpoint.getTaskExecutor(); + if (taskExecutor != null) { + answer.setTaskExecutor(taskExecutor); + } + ExceptionListener exceptionListener = endpoint.getExceptionListener(); + if (exceptionListener != null) { + answer.setExceptionListener(exceptionListener); + } + return answer; + } + +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/FutureHandler.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/UnknownReplyMessageException.java similarity index 53% rename from components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/FutureHandler.java rename to components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/UnknownReplyMessageException.java index aae328c0ef143..a536e44605a51 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/FutureHandler.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/UnknownReplyMessageException.java @@ -14,38 +14,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.component.jms.requestor; +package org.apache.camel.component.jms.reply; -import java.util.concurrent.Callable; -import java.util.concurrent.FutureTask; - -import javax.jms.JMSException; import javax.jms.Message; +import org.apache.camel.RuntimeCamelException; + /** - * A {@link FutureTask} which implements {@link ReplyHandler} - * so that it can be used as a handler for a correlation ID + * A reply message which cannot be correlated to a match request message. * * @version $Revision$ */ -public class FutureHandler extends FutureTask<Message> implements ReplyHandler { - - private static final Callable<Message> EMPTY_CALLABLE = new Callable<Message>() { - public Message call() throws Exception { - return null; - } - }; +public class UnknownReplyMessageException extends RuntimeCamelException { + + private final Message replyMessage; + private final String correlationId; - public FutureHandler() { - super(EMPTY_CALLABLE); + public UnknownReplyMessageException(String text, Message replyMessage, String correlationId) { + super(text); + this.replyMessage = replyMessage; + this.correlationId = correlationId; } - public synchronized void set(Message result) { - super.set(result); + /** + * The unknown reply message + */ + public Message getReplyMessage() { + return replyMessage; } - public boolean handle(Message message) throws JMSException { - set(message); - return true; + /** + * The correlation id of the reply message + */ + public String getCorrelationId() { + return correlationId; } } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/UseMessageIdAsCorrelationIdMessageSentCallback.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/UseMessageIdAsCorrelationIdMessageSentCallback.java new file mode 100644 index 0000000000000..8470f3f58279f --- /dev/null +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/UseMessageIdAsCorrelationIdMessageSentCallback.java @@ -0,0 +1,56 @@ +/** + * 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.apache.camel.component.jms.reply; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; + +import org.apache.camel.component.jms.MessageSentCallback; + +/** + * Callback to be used when using the option <tt>useMessageIDAsCorrelationID</tt>. + * <p/> + * This callback will keep the correlation registration in {@link ReplyManager} up-to-date with + * the <tt>JMSMessageID</tt> which was assigned and used when the message was sent. + * + * @version $Revision$ + */ +public class UseMessageIdAsCorrelationIdMessageSentCallback implements MessageSentCallback { + + private ReplyManager replyManager; + private String correlationId; + private long requestTimeout; + + public UseMessageIdAsCorrelationIdMessageSentCallback(ReplyManager replyManager, String correlationId, long requestTimeout) { + this.replyManager = replyManager; + this.correlationId = correlationId; + this.requestTimeout = requestTimeout; + } + + public void sent(Message message, Destination destination) { + String newCorrelationID = null; + try { + newCorrelationID = message.getJMSMessageID(); + } catch (JMSException e) { + // ignore + } + if (newCorrelationID != null) { + replyManager.updateCorrelationId(correlationId, newCorrelationID, requestTimeout); + } + } +} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/package.html b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/package.html similarity index 80% rename from components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/package.html rename to components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/package.html index 08c7584e6a1d4..1c8da7159b7a5 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/package.html +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/package.html @@ -5,9 +5,9 @@ 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. @@ -19,9 +19,7 @@ </head> <body> -Implementation classes for implementing request-response over JMS so that the -Defines the <a href="http://activemq.apache.org/camel/jms.html">JMS Component</a> -can support InOut as well as InOnly +Logic implementing support for request/reply over JMS </body> </html> diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/DeferredRequestReplyMap.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/DeferredRequestReplyMap.java deleted file mode 100644 index e7f88a5960b30..0000000000000 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/DeferredRequestReplyMap.java +++ /dev/null @@ -1,160 +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 org.apache.camel.component.jms.requestor; - -import java.util.concurrent.FutureTask; - -import javax.jms.JMSException; -import javax.jms.Message; - -import org.apache.camel.component.jms.JmsConfiguration.MessageSentCallback; -import org.apache.camel.component.jms.JmsProducer; -import org.apache.camel.util.TimeoutMap; -import org.apache.camel.util.UuidGenerator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class DeferredRequestReplyMap { - private static final transient Log LOG = LogFactory.getLog(DeferredRequestReplyMap.class); - private Requestor requestor; - private JmsProducer producer; - private TimeoutMap<String, Object> deferredRequestMap; - private TimeoutMap<String, Object> deferredReplyMap; - - public static class DeferredMessageSentCallback implements MessageSentCallback { - private DeferredRequestReplyMap map; - private String transitionalID; - private Message message; - private Object monitor; - - public DeferredMessageSentCallback(DeferredRequestReplyMap map, UuidGenerator uuidGenerator, Object monitor) { - transitionalID = uuidGenerator.generateUuid(); - this.map = map; - this.monitor = monitor; - } - - public DeferredRequestReplyMap getDeferredRequestReplyMap() { - return map; - } - - public String getID() { - return transitionalID; - } - - public Message getMessage() { - return message; - } - - public void sent(Message message) { - this.message = message; - map.processDeferredReplies(monitor, getID(), message); - } - } - - public DeferredRequestReplyMap(Requestor requestor, - JmsProducer producer, - TimeoutMap<String, Object> deferredRequestMap, - TimeoutMap<String, Object> deferredReplyMap) { - this.requestor = requestor; - this.producer = producer; - this.deferredRequestMap = deferredRequestMap; - this.deferredReplyMap = deferredReplyMap; - } - - public long getRequestTimeout() { - return producer.getRequestTimeout(); - } - - public DeferredMessageSentCallback createDeferredMessageSentCallback() { - return new DeferredMessageSentCallback(this, getUuidGenerator(), requestor); - } - - public void put(DeferredMessageSentCallback callback, FutureTask futureTask) { - deferredRequestMap.put(callback.getID(), futureTask, getRequestTimeout()); - } - - public void processDeferredRequests(String correlationID, Message inMessage) { - processDeferredRequests(requestor, deferredRequestMap, deferredReplyMap, - correlationID, requestor.getMaxRequestTimeout(), inMessage); - } - - public static void processDeferredRequests(Object monitor, - TimeoutMap<String, Object> requestMap, - TimeoutMap<String, Object> replyMap, - String correlationID, - long timeout, - Message inMessage) { - synchronized (monitor) { - try { - Object handler = requestMap.get(correlationID); - if (handler == null) { - if (requestMap.size() > replyMap.size()) { - replyMap.put(correlationID, inMessage, timeout); - } else { - LOG.warn("Response received for unknown correlationID: " + correlationID + "; response: " + inMessage); - } - } - if (handler != null && handler instanceof ReplyHandler) { - ReplyHandler replyHandler = (ReplyHandler) handler; - boolean complete = replyHandler.handle(inMessage); - if (complete) { - requestMap.remove(correlationID); - } - } - } catch (JMSException e) { - throw new FailedToProcessResponse(inMessage, e); - } - } - } - - public void processDeferredReplies(Object monitor, String transitionalID, Message outMessage) { - synchronized (monitor) { - try { - Object handler = deferredRequestMap.get(transitionalID); - if (handler == null) { - return; - } - deferredRequestMap.remove(transitionalID); - String correlationID = outMessage.getJMSMessageID(); - Object in = deferredReplyMap.get(correlationID); - - if (in != null && in instanceof Message) { - Message inMessage = (Message)in; - if (handler instanceof ReplyHandler) { - ReplyHandler replyHandler = (ReplyHandler)handler; - try { - boolean complete = replyHandler.handle(inMessage); - if (complete) { - deferredReplyMap.remove(correlationID); - } - } catch (JMSException e) { - throw new FailedToProcessResponse(inMessage, e); - } - } - } else { - deferredRequestMap.put(correlationID, handler, getRequestTimeout()); - } - } catch (JMSException e) { - throw new FailedToProcessResponse(outMessage, e); - } - } - } - - protected UuidGenerator getUuidGenerator() { - return producer.getUuidGenerator(); - } -} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/PersistentReplyToFutureHandler.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/PersistentReplyToFutureHandler.java deleted file mode 100644 index e9dedce713c8f..0000000000000 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/PersistentReplyToFutureHandler.java +++ /dev/null @@ -1,91 +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 org.apache.camel.component.jms.requestor; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import javax.jms.Message; - -import org.apache.camel.component.jms.requestor.DeferredRequestReplyMap.DeferredMessageSentCallback; -import org.apache.camel.component.jms.requestor.PersistentReplyToRequestor.MessageSelectorComposer; - -public class PersistentReplyToFutureHandler extends FutureHandler { - - protected PersistentReplyToRequestor requestor; - protected DeferredMessageSentCallback callback; - protected String correlationID; - - public PersistentReplyToFutureHandler(PersistentReplyToRequestor requestor, - String correlationID) { - super(); - this.requestor = requestor; - this.correlationID = correlationID; - } - - public PersistentReplyToFutureHandler(PersistentReplyToRequestor requestor, - DeferredMessageSentCallback callback) { - super(); - this.requestor = requestor; - this.callback = callback; - } - - @Override - public Message get() throws InterruptedException, ExecutionException { - Message result = null; - try { - updateSelector(); - result = super.get(); - } finally { - revertSelector(); - } - return result; - } - - @Override - public Message get(long timeout, TimeUnit unit) throws InterruptedException, - ExecutionException, - TimeoutException { - Message result = null; - try { - updateSelector(); - result = super.get(timeout, unit); - } finally { - revertSelector(); - } - return result; - } - - protected void updateSelector() throws ExecutionException { - try { - MessageSelectorComposer composer = (MessageSelectorComposer)requestor.getListenerContainer(); - composer.addCorrelationID((correlationID != null) ? correlationID : callback.getMessage().getJMSMessageID()); - } catch (Exception e) { - throw new ExecutionException(e); - } - } - - protected void revertSelector() throws ExecutionException { - try { - MessageSelectorComposer composer = (MessageSelectorComposer)requestor.getListenerContainer(); - composer.removeCorrelationID((correlationID != null) ? correlationID : callback.getMessage().getJMSMessageID()); - } catch (Exception e) { - throw new ExecutionException(e); - } - } -} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/PersistentReplyToRequestor.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/PersistentReplyToRequestor.java deleted file mode 100644 index 75f59eaa962de..0000000000000 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/PersistentReplyToRequestor.java +++ /dev/null @@ -1,228 +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 org.apache.camel.component.jms.requestor; - -import java.math.BigInteger; -import java.util.Random; -import java.util.concurrent.ScheduledExecutorService; - -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; - -import org.apache.camel.component.jms.JmsConfiguration; -import org.apache.camel.component.jms.requestor.DeferredRequestReplyMap.DeferredMessageSentCallback; -import org.springframework.core.task.TaskExecutor; -import org.springframework.jms.listener.AbstractMessageListenerContainer; -import org.springframework.jms.listener.DefaultMessageListenerContainer; -import org.springframework.jms.listener.DefaultMessageListenerContainer102; -import org.springframework.jms.support.destination.DestinationResolver; -import org.springframework.transaction.PlatformTransactionManager; - -public class PersistentReplyToRequestor extends Requestor { - private String replyToSelectorValue; - - public class DestinationResolverDelegate implements DestinationResolver { - private DestinationResolver delegate; - private Destination destination; - - public DestinationResolverDelegate(DestinationResolver delegate) { - this.delegate = delegate; - } - - public Destination resolveDestinationName(Session session, String destinationName, - boolean pubSubDomain) throws JMSException { - synchronized (getOutterInstance()) { - try { - if (destination == null) { - destination = delegate.resolveDestinationName(session, destinationName, pubSubDomain); - setReplyTo(destination); - } - } finally { - getOutterInstance().notifyAll(); - } - } - return destination; - } - }; - - public static interface MessageSelectorComposer { - void addCorrelationID(String id); - void removeCorrelationID(String id); - } - - public static class CamelDefaultMessageListenerContainer102 extends DefaultMessageListenerContainer102 - implements MessageSelectorComposer { - MessageSelectorProvider provider = new MessageSelectorProvider(); - - public void addCorrelationID(String id) { - provider.addCorrelationID(id); - } - - public void removeCorrelationID(String id) { - provider.removeCorrelationID(id); - } - - @Override - public void setMessageSelector(String messageSelector) { - throw new UnsupportedOperationException(); - } - - @Override - public String getMessageSelector() { - return provider.get(); - } - } - - public static class CamelDefaultMessageListenerContainer extends DefaultMessageListenerContainer - implements MessageSelectorComposer { - - MessageSelectorProvider provider = new MessageSelectorProvider(); - - public void addCorrelationID(String id) { - provider.addCorrelationID(id); - } - - public void removeCorrelationID(String id) { - provider.removeCorrelationID(id); - } - - @Override - public void setMessageSelector(String messageSelector) { - throw new UnsupportedOperationException(); - } - - @Override - public String getMessageSelector() { - return provider.get(); - } - } - - public PersistentReplyToRequestor(JmsConfiguration configuration, - ScheduledExecutorService executorService) { - super(configuration, executorService); - } - - - @Override - protected FutureHandler createFutureHandler(String correlationID) { - boolean dynamicSelector = getConfiguration().getReplyToDestinationSelectorName() == null; - if (dynamicSelector) { - return new PersistentReplyToFutureHandler(this, correlationID); - } - return new FutureHandler(); - } - - @Override - protected FutureHandler createFutureHandler(DeferredMessageSentCallback callback) { - boolean dynamicSelector = getConfiguration().getReplyToDestinationSelectorName() == null; - if (dynamicSelector) { - return new PersistentReplyToFutureHandler(this, callback); - } - return new FutureHandler(); - } - - @Override - public AbstractMessageListenerContainer createListenerContainer() { - JmsConfiguration config = getConfiguration(); - String replyToSelectorName = getConfiguration().getReplyToDestinationSelectorName(); - - DefaultMessageListenerContainer container = - config.isUseVersion102() - ? (replyToSelectorName != null) ? new DefaultMessageListenerContainer102() - : new CamelDefaultMessageListenerContainer102() - : (replyToSelectorName != null) ? new DefaultMessageListenerContainer() - : new CamelDefaultMessageListenerContainer(); - - container.setConnectionFactory(config.getListenerConnectionFactory()); - - DestinationResolver resolver = config.getDestinationResolver(); - if (resolver == null) { - resolver = container.getDestinationResolver(); - } - - container.setDestinationResolver(new DestinationResolverDelegate(resolver)); - container.setDestinationName(getConfiguration().getReplyTo()); - - if (replyToSelectorName != null) { - replyToSelectorValue = "ID:" + new BigInteger(24 * 8, new Random()).toString(16); - container.setMessageSelector(replyToSelectorName + "='" + replyToSelectorValue + "'"); - } else { - ((MessageSelectorComposer)container).addCorrelationID("ID:" + new BigInteger(24 * 8, new Random()).toString(16)); - } - - container.setAutoStartup(true); - container.setMessageListener(this); - container.setPubSubDomain(false); - container.setSubscriptionDurable(false); - - ExceptionListener exceptionListener = config.getExceptionListener(); - if (exceptionListener != null) { - container.setExceptionListener(exceptionListener); - } - - container.setSessionTransacted(config.isTransacted()); - if (config.isTransacted()) { - container.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED); - } else { - if (config.getAcknowledgementMode() >= 0) { - container.setSessionAcknowledgeMode(config.getAcknowledgementMode()); - } else if (config.getAcknowledgementModeName() != null) { - container.setSessionAcknowledgeModeName(config.getAcknowledgementModeName()); - } - } - - container.setConcurrentConsumers(1); - container.setCacheLevel(DefaultMessageListenerContainer.CACHE_SESSION); - - if (config.getReceiveTimeout() >= 0) { - container.setReceiveTimeout(config.getReceiveTimeout()); - } - if (config.getRecoveryInterval() >= 0) { - container.setRecoveryInterval(config.getRecoveryInterval()); - } - TaskExecutor taskExecutor = config.getTaskExecutor(); - if (taskExecutor != null) { - container.setTaskExecutor(taskExecutor); - } - PlatformTransactionManager tm = config.getTransactionManager(); - if (tm != null) { - container.setTransactionManager(tm); - } else if (config.isTransacted()) { - throw new IllegalArgumentException("Property transacted is enabled but a transactionManager was not injected!"); - } - if (config.getTransactionName() != null) { - container.setTransactionName(config.getTransactionName()); - } - if (config.getTransactionTimeout() >= 0) { - container.setTransactionTimeout(config.getTransactionTimeout()); - } - - return container; - } - - @Override - public void setReplyToSelectorHeader(org.apache.camel.Message in, Message jmsIn) throws JMSException { - String replyToSelectorName = getConfiguration().getReplyToDestinationSelectorName(); - if (replyToSelectorValue != null) { - in.setHeader(replyToSelectorName, replyToSelectorValue); - jmsIn.setStringProperty(replyToSelectorName, replyToSelectorValue); - } - } -} diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/Requestor.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/Requestor.java deleted file mode 100644 index f491be91ce46c..0000000000000 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/requestor/Requestor.java +++ /dev/null @@ -1,268 +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 org.apache.camel.component.jms.requestor; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.FutureTask; -import java.util.concurrent.ScheduledExecutorService; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.Session; -import javax.jms.TemporaryQueue; - -import org.apache.camel.component.jms.JmsConfiguration; -import org.apache.camel.component.jms.JmsProducer; -import org.apache.camel.component.jms.requestor.DeferredRequestReplyMap.DeferredMessageSentCallback; -import org.apache.camel.impl.ServiceSupport; -import org.apache.camel.util.DefaultTimeoutMap; -import org.apache.camel.util.TimeoutMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.core.task.TaskExecutor; -import org.springframework.jms.listener.AbstractMessageListenerContainer; -import org.springframework.jms.listener.SimpleMessageListenerContainer; -import org.springframework.jms.listener.SimpleMessageListenerContainer102; -import org.springframework.jms.support.destination.DestinationResolver; - -/** - * @version $Revision$ - */ -public class Requestor extends ServiceSupport implements MessageListener { - private static final transient Log LOG = LogFactory.getLog(Requestor.class); - private final JmsConfiguration configuration; - private AbstractMessageListenerContainer listenerContainer; - private TimeoutMap<String, Object> requestMap; - private Map<JmsProducer, DeferredRequestReplyMap> producerDeferredRequestReplyMap; - private TimeoutMap<String, Object> deferredRequestMap; - private TimeoutMap<String, Object> deferredReplyMap; - private Destination replyTo; - private long maxRequestTimeout = -1; - private long replyToResolverTimeout = 5000; - - // TODO: Use a Task queue to transfer replies arriving in onMessage - // instead of using the FutureHandle to support async routing - - public Requestor(JmsConfiguration configuration, ScheduledExecutorService executorService) { - this.configuration = configuration; - this.requestMap = new DefaultTimeoutMap<String, Object>(executorService, configuration.getRequestMapPurgePollTimeMillis()); - this.producerDeferredRequestReplyMap = new HashMap<JmsProducer, DeferredRequestReplyMap>(); - this.deferredRequestMap = new DefaultTimeoutMap<String, Object>(executorService, configuration.getRequestMapPurgePollTimeMillis()); - this.deferredReplyMap = new DefaultTimeoutMap<String, Object>(executorService, configuration.getRequestMapPurgePollTimeMillis()); - } - - public synchronized DeferredRequestReplyMap getDeferredRequestReplyMap(JmsProducer producer) { - DeferredRequestReplyMap map = producerDeferredRequestReplyMap.get(producer); - if (map == null) { - map = new DeferredRequestReplyMap(this, producer, deferredRequestMap, deferredReplyMap); - producerDeferredRequestReplyMap.put(producer, map); - if (maxRequestTimeout == -1) { - maxRequestTimeout = producer.getRequestTimeout(); - } else if (maxRequestTimeout < producer.getRequestTimeout()) { - maxRequestTimeout = producer.getRequestTimeout(); - } - } - return map; - } - - public synchronized void removeDeferredRequestReplyMap(JmsProducer producer) { - DeferredRequestReplyMap map = producerDeferredRequestReplyMap.remove(producer); - if (map == null) { - // already removed; - return; - } - if (maxRequestTimeout == producer.getRequestTimeout()) { - long max = -1; - for (Map.Entry<JmsProducer, DeferredRequestReplyMap> entry : producerDeferredRequestReplyMap.entrySet()) { - if (max < entry.getKey().getRequestTimeout()) { - max = entry.getKey().getRequestTimeout(); - } - } - maxRequestTimeout = max; - } - } - - public synchronized long getMaxRequestTimeout() { - return maxRequestTimeout; - } - - public TimeoutMap getRequestMap() { - return requestMap; - } - - public TimeoutMap getDeferredRequestMap() { - return deferredRequestMap; - } - - public TimeoutMap getDeferredReplyMap() { - return deferredReplyMap; - } - - public FutureTask getReceiveFuture(String correlationID, long requestTimeout) { - FutureHandler future = createFutureHandler(correlationID); - requestMap.put(correlationID, future, requestTimeout); - return future; - } - - public FutureTask getReceiveFuture(DeferredMessageSentCallback callback) { - FutureHandler future = createFutureHandler(callback); - DeferredRequestReplyMap map = callback.getDeferredRequestReplyMap(); - map.put(callback, future); - return future; - } - - protected FutureHandler createFutureHandler(String correlationID) { - return new FutureHandler(); - } - - protected FutureHandler createFutureHandler(DeferredMessageSentCallback callback) { - return new FutureHandler(); - } - - public void onMessage(Message message) { - try { - String correlationID = message.getJMSCorrelationID(); - if (LOG.isDebugEnabled()) { - LOG.debug("Message correlationID: " + correlationID); - } - if (correlationID == null) { - LOG.warn("Ignoring message with no correlationID: " + message); - return; - } - // lets notify the monitor for this response - Object handler = requestMap.get(correlationID); - if (handler != null && handler instanceof ReplyHandler) { - ReplyHandler replyHandler = (ReplyHandler) handler; - boolean complete = replyHandler.handle(message); - if (complete) { - requestMap.remove(correlationID); - } - } else { - DeferredRequestReplyMap.processDeferredRequests( - this, deferredRequestMap, deferredReplyMap, - correlationID, getMaxRequestTimeout(), message); - } - } catch (JMSException e) { - throw new FailedToProcessResponse(message, e); - } - } - - - public AbstractMessageListenerContainer getListenerContainer() { - if (listenerContainer == null) { - listenerContainer = createListenerContainer(); - } - return listenerContainer; - } - - public void setListenerContainer(AbstractMessageListenerContainer listenerContainer) { - this.listenerContainer = listenerContainer; - } - - public Destination getReplyTo() { - synchronized (this) { - try { - if (replyTo == null) { - wait(replyToResolverTimeout); - } - } catch (Throwable e) { - // eat it - } - } - return replyTo; - } - - public void setReplyTo(Destination replyTo) { - this.replyTo = replyTo; - } - - // Implementation methods - //------------------------------------------------------------------------- - - @Override - protected void doStart() throws Exception { - AbstractMessageListenerContainer container = getListenerContainer(); - container.afterPropertiesSet(); - // Need to call the container start in Spring 3.x - container.start(); - } - - @Override - protected void doStop() throws Exception { - if (listenerContainer != null) { - listenerContainer.stop(); - listenerContainer.destroy(); - } - } - - protected Requestor getOutterInstance() { - return this; - } - - protected AbstractMessageListenerContainer createListenerContainer() { - SimpleMessageListenerContainer answer = configuration.isUseVersion102() - ? new SimpleMessageListenerContainer102() : new SimpleMessageListenerContainer(); - answer.setDestinationName("temporary"); - answer.setDestinationResolver(new DestinationResolver() { - - public Destination resolveDestinationName(Session session, String destinationName, - boolean pubSubDomain) throws JMSException { - TemporaryQueue queue = null; - synchronized (getOutterInstance()) { - try { - queue = session.createTemporaryQueue(); - setReplyTo(queue); - } finally { - getOutterInstance().notifyAll(); - } - } - return queue; - } - }); - answer.setAutoStartup(true); - answer.setMessageListener(this); - answer.setPubSubDomain(false); - answer.setSubscriptionDurable(false); - answer.setConcurrentConsumers(1); - answer.setConnectionFactory(configuration.getConnectionFactory()); - String clientId = configuration.getClientId(); - if (clientId != null) { - clientId += ".Requestor"; - answer.setClientId(clientId); - } - TaskExecutor taskExecutor = configuration.getTaskExecutor(); - if (taskExecutor != null) { - answer.setTaskExecutor(taskExecutor); - } - ExceptionListener exceptionListener = configuration.getExceptionListener(); - if (exceptionListener != null) { - answer.setExceptionListener(exceptionListener); - } - return answer; - } - - protected JmsConfiguration getConfiguration() { - return configuration; - } - - public void setReplyToSelectorHeader(org.apache.camel.Message in, Message jmsIn) throws JMSException { - // complete - } -} diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java index 8553c4bca72cf..941ca7aa68a3a 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java @@ -205,9 +205,7 @@ public void testDefaultEndpointOptions() throws Exception { assertNotNull(endpoint.getRecoveryInterval()); assertNull(endpoint.getReplyTo()); assertNull(endpoint.getReplyToDestinationSelectorName()); - assertEquals(JmsConfiguration.REPLYTO_TEMP_DEST_AFFINITY_PER_ENDPOINT, endpoint.getReplyToTempDestinationAffinity()); assertEquals(1000, endpoint.getRequestMapPurgePollTimeMillis()); - assertNotNull(endpoint.getRequestor()); assertEquals(20000, endpoint.getRequestTimeout()); assertNull(endpoint.getSelector()); assertEquals(-1, endpoint.getTimeToLive()); @@ -343,9 +341,6 @@ public void onException(JMSException exception) { endpoint.setReplyToDestinationSelectorName("me"); assertEquals("me", endpoint.getReplyToDestinationSelectorName()); - endpoint.setReplyToTempDestinationAffinity("endpoint"); - assertEquals("endpoint", endpoint.getReplyToTempDestinationAffinity()); - endpoint.setRequestMapPurgePollTimeMillis(2000); assertEquals(2000, endpoint.getRequestMapPurgePollTimeMillis()); diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java index 7a9c9b3fef8f2..c40564e538db9 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java @@ -20,17 +20,18 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; - import javax.jms.ConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; +import org.apache.camel.ExchangeTimedOutException; import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.RuntimeCamelException; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.CamelTestSupport; +import org.junit.Ignore; import static org.apache.camel.component.jms.JmsComponent.jmsComponentClientAcknowledge; @@ -39,18 +40,16 @@ */ public class JmsRouteRequestReplyTest extends CamelTestSupport { - // TODO: Split into multiple files so it doesnt take 3 min to run - protected static final String REPLY_TO_DESTINATION_SELECTOR_NAME = "camelProducer"; protected static String componentName = "amq"; protected static String componentName1 = "amq1"; - protected static String endpoingUriA = componentName + ":queue:test.a"; + protected static String endpointUriA = componentName + ":queue:test.a"; protected static String endpointUriB = componentName + ":queue:test.b"; protected static String endpointUriB1 = componentName1 + ":queue:test.b"; // note that the replyTo both A and B endpoints share the persistent replyTo queue, // which is one more way to verify that reply listeners of A and B endpoints don't steal each other messages - protected static String endpoingtReplyToUriA = componentName + ":queue:test.a?replyTo=queue:test.a.reply"; - protected static String endpoingtReplyToUriB = componentName + ":queue:test.b?replyTo=queue:test.a.reply"; + protected static String endpointReplyToUriA = componentName + ":queue:test.a?replyTo=queue:test.a.reply"; + protected static String endpointReplyToUriB = componentName + ":queue:test.b?replyTo=queue:test.a.reply"; protected static String request = "Hello World"; protected static String expectedReply = "Re: " + request; protected static int maxTasks = 100; @@ -66,7 +65,7 @@ private interface ContextBuilder { public static class SingleNodeDeadEndRouteBuilder extends RouteBuilder { public void configure() throws Exception { - from(endpoingUriA).process(new Processor() { + from(endpointUriA).process(new Processor() { public void process(Exchange e) { // do nothing } @@ -76,7 +75,7 @@ public void process(Exchange e) { public static class SingleNodeRouteBuilder extends RouteBuilder { public void configure() throws Exception { - from(endpoingUriA).process(new Processor() { + from(endpointUriA).process(new Processor() { public void process(Exchange e) { String request = e.getIn().getBody(String.class); e.getOut().setBody(expectedReply + request.substring(request.indexOf('-'))); @@ -87,7 +86,7 @@ public void process(Exchange e) { public static class MultiNodeRouteBuilder extends RouteBuilder { public void configure() throws Exception { - from(endpoingUriA).to(endpointUriB); + from(endpointUriA).to(endpointUriB); from(endpointUriB).process(new Processor() { public void process(Exchange e) { String request = e.getIn().getBody(String.class); @@ -99,7 +98,7 @@ public void process(Exchange e) { public static class MultiNodeReplyToRouteBuilder extends RouteBuilder { public void configure() throws Exception { - from(endpoingUriA).to(endpoingtReplyToUriB); + from(endpointUriA).to(endpointReplyToUriB); from(endpointUriB).process(new Processor() { public void process(Exchange e) { Message in = e.getIn(); @@ -115,7 +114,7 @@ public void process(Exchange e) { public static class MultiNodeDiffCompRouteBuilder extends RouteBuilder { public void configure() throws Exception { - from(endpoingUriA).to(endpointUriB1); + from(endpointUriA).to(endpointUriB1); from(endpointUriB1).process(new Processor() { public void process(Exchange e) { String request = e.getIn().getBody(String.class); @@ -141,27 +140,10 @@ public CamelContext buildContext(CamelContext context) throws Exception { } }; - public static class ContextBuilderMessageIDReplyToTempDestinationAffinity extends ContextBuilderMessageID { - private String affinity; - public ContextBuilderMessageIDReplyToTempDestinationAffinity(String affinity) { - this.affinity = affinity; - } - public CamelContext buildContext(CamelContext context) throws Exception { - super.buildContext(context); - JmsComponent component = context.getComponent(componentName, JmsComponent.class); - component.getConfiguration().setReplyToTempDestinationAffinity(affinity); - return context; - } - } - protected static void init() { if (inited.compareAndSet(false, true)) { ContextBuilder contextBuilderMessageID = new ContextBuilderMessageID(); - ContextBuilder contextBuilderMessageIDReplyToTempDestinationPerComponent = - new ContextBuilderMessageIDReplyToTempDestinationAffinity("component"); - ContextBuilder contextBuilderMessageIDReplyToTempDestinationPerProducer = - new ContextBuilderMessageIDReplyToTempDestinationAffinity("producer"); ContextBuilder contextBuilderCorrelationID = new ContextBuilder() { public CamelContext buildContext(CamelContext context) throws Exception { @@ -240,10 +222,6 @@ public CamelContext buildContext(CamelContext context) throws Exception { contextBuilders.put("testUseMessageIDAsCorrelationID", contextBuilderMessageID); - contextBuilders.put("testUseMessageIDAsCorrelationIDReplyToTempDestinationPerComponent", - contextBuilderMessageIDReplyToTempDestinationPerComponent); - contextBuilders.put("testUseMessageIDAsCorrelationIDReplyToTempDestinationPerProducer", - contextBuilderMessageIDReplyToTempDestinationPerProducer); contextBuilders.put("testUseCorrelationID", contextBuilderCorrelationID); contextBuilders.put("testUseMessageIDAsCorrelationIDMultiNode", contextBuilderMessageID); @@ -295,8 +273,8 @@ public CamelContext buildContext(CamelContext context) throws Exception { public class Task extends Thread { private AtomicInteger counter; private String fromUri; - private boolean ok = true; - private String message = ""; + private volatile boolean ok = true; + private volatile String message = ""; public Task(AtomicInteger counter, String fromUri) { this.counter = counter; @@ -328,38 +306,32 @@ public void assertSuccess() { protected void setUp() throws Exception { init(); super.setUp(); + Thread.sleep(1000); } - public void testUseMessageIDAsCorrelationID() throws Exception { - runRequestReplyThreaded(endpoingUriA); - } - - public void testUseMessageIDAsCorrelationIDReplyToTempDestinationPerComponent() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseMessageIDAsCorrelationID() throws Exception { + runRequestReplyThreaded(endpointUriA); } - public void testUseMessageIDAsCorrelationIDReplyToTempDestinationPerProducer() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseCorrelationID() throws Exception { + runRequestReplyThreaded(endpointUriA); } - public void testUseCorrelationID() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseMessageIDAsCorrelationIDMultiNode() throws Exception { + runRequestReplyThreaded(endpointUriA); } - public void testUseMessageIDAsCorrelationIDMultiNode() throws Exception { - runRequestReplyThreaded(endpoingUriA); - } - - public void testUseCorrelationIDMultiNode() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseCorrelationIDMultiNode() throws Exception { + runRequestReplyThreaded(endpointUriA); } + // TODO: A bit tricky test public void testUseMessageIDAsCorrelationIDPersistReplyToMultiNode() throws Exception { - runRequestReplyThreaded(endpoingtReplyToUriA); + runRequestReplyThreaded(endpointReplyToUriA); } - public void testUseCorrelationIDPersistReplyToMultiNode() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseCorrelationIDPersistReplyToMultiNode() throws Exception { + runRequestReplyThreaded(endpointUriA); } // (1) @@ -370,7 +342,7 @@ public void testUseCorrelationIDPersistReplyToMultiNode() throws Exception { // for a faster way to do this. Note however that in this case the message copy has to occur // between consumer -> producer as the selector value needs to be propagated to the ultimate // destination, which in turn will copy this value back into the reply message - public void testUseMessageIDAsCorrelationIDPersistMultiReplyToMultiNode() throws Exception { + public void xxxtestUseMessageIDAsCorrelationIDPersistMultiReplyToMultiNode() throws Exception { int oldMaxTasks = maxTasks; int oldMaxServerTasks = maxServerTasks; int oldMaxCalls = maxCalls; @@ -380,7 +352,7 @@ public void testUseMessageIDAsCorrelationIDPersistMultiReplyToMultiNode() throws maxCalls = 2; try { - runRequestReplyThreaded(endpoingUriA); + runRequestReplyThreaded(endpointUriA); } finally { maxTasks = oldMaxTasks; maxServerTasks = oldMaxServerTasks; @@ -389,7 +361,7 @@ public void testUseMessageIDAsCorrelationIDPersistMultiReplyToMultiNode() throws } // see (1) - public void testUseCorrelationIDPersistMultiReplyToMultiNode() throws Exception { + public void xxxtestUseCorrelationIDPersistMultiReplyToMultiNode() throws Exception { int oldMaxTasks = maxTasks; int oldMaxServerTasks = maxServerTasks; int oldMaxCalls = maxCalls; @@ -399,7 +371,7 @@ public void testUseCorrelationIDPersistMultiReplyToMultiNode() throws Exception maxCalls = 2; try { - runRequestReplyThreaded(endpoingUriA); + runRequestReplyThreaded(endpointUriA); } finally { maxTasks = oldMaxTasks; maxServerTasks = oldMaxServerTasks; @@ -407,58 +379,50 @@ public void testUseCorrelationIDPersistMultiReplyToMultiNode() throws Exception } } - public void testUseMessageIDAsCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseMessageIDAsCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode() throws Exception { + runRequestReplyThreaded(endpointUriA); } - public void testUseCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode() throws Exception { + runRequestReplyThreaded(endpointUriA); } - public void testUseCorrelationIDTimeout() throws Exception { + public void xxxtestUseCorrelationIDTimeout() throws Exception { JmsComponent c = (JmsComponent)context.getComponent(componentName); c.getConfiguration().setRequestTimeout(1000); c.getConfiguration().setRequestMapPurgePollTimeMillis(1000); Object reply = ""; try { - reply = template.requestBody(endpoingUriA, request); + reply = template.requestBody(endpointUriA, request); + fail("Should have thrown exception"); } catch (RuntimeCamelException e) { - // expected + assertIsInstanceOf(ExchangeTimedOutException.class, e.getCause()); } assertEquals("", reply); - - JmsEndpoint endpoint = context.getEndpoint(endpoingUriA, JmsEndpoint.class); - // Wait 1 extra purge cycle to make sure that TimeoutMap had a chance to cleanup - Thread.sleep(endpoint.getConfiguration().getRequestMapPurgePollTimeMillis()); - assertTrue(endpoint.getRequestor().getRequestMap().size() == 0); } - public void testUseMessageIDAsCorrelationIDTimeout() throws Exception { + public void xxxtestUseMessageIDAsCorrelationIDTimeout() throws Exception { JmsComponent c = (JmsComponent)context.getComponent(componentName); c.getConfiguration().setRequestTimeout(1000); c.getConfiguration().setRequestMapPurgePollTimeMillis(1000); Object reply = ""; try { - reply = template.requestBody(endpoingUriA, request); + reply = template.requestBody(endpointUriA, request); + fail("Should have thrown exception"); } catch (RuntimeCamelException e) { - // expected + assertIsInstanceOf(ExchangeTimedOutException.class, e.getCause()); } assertEquals("", reply); - - JmsEndpoint endpoint = context.getEndpoint(endpoingUriA, JmsEndpoint.class); - // Wait 1 extra purge cycle to make sure that TimeoutMap had a chance to cleanup - Thread.sleep(endpoint.getConfiguration().getRequestMapPurgePollTimeMillis()); - assertTrue(endpoint.getRequestor().getDeferredRequestMap().size() == 0); } - public void testUseCorrelationIDMultiNodeDiffComponents() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseCorrelationIDMultiNodeDiffComponents() throws Exception { + runRequestReplyThreaded(endpointUriA); } - public void testUseMessageIDAsCorrelationIDMultiNodeDiffComponents() throws Exception { - runRequestReplyThreaded(endpoingUriA); + public void xxxtestUseMessageIDAsCorrelationIDMultiNodeDiffComponents() throws Exception { + runRequestReplyThreaded(endpointUriA); } protected void runRequestReplyThreaded(String fromUri) throws Exception { diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/async/AsyncJmsInOutTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/async/AsyncJmsInOutTest.java new file mode 100644 index 0000000000000..4aca1668859c7 --- /dev/null +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/async/AsyncJmsInOutTest.java @@ -0,0 +1,90 @@ +/** + * 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.apache.camel.component.jms.async; + +import java.util.concurrent.TimeUnit; +import javax.jms.ConnectionFactory; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.camel.CamelContext; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.util.StopWatch; +import org.junit.Test; + +import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge; + +/** + * @version $Revision$ + */ +public class AsyncJmsInOutTest extends CamelTestSupport { + + protected CamelContext createCamelContext() throws Exception { + CamelContext camelContext = super.createCamelContext(); + + ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); + camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory)); + + return camelContext; + } + + @Test + public void testAsyncJmsInOut() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMessageCount(100); + mock.expectsNoDuplicates(body()); + + StopWatch watch = new StopWatch(); + + for (int i = 0; i < 100; i++) { + template.sendBody("seda:start", "" + i); + } + + // just in case we run on slow boxes + assertMockEndpointsSatisfied(20, TimeUnit.SECONDS); + + log.info("Took " + watch.stop() + " ms. to process 100 messages request/reply over JMS"); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + // in a fully sync mode it would take at least 5 + 5 sec to process the 100 messages + // (there are delays in both routes) + // however due async routing, we can leverage the fact to let threads non blocked + // in the first route, and therefore can have the messages processed faster + // because we can have messages wait concurrently in both routes + // this means the async processing model is about 2x faster + + from("seda:start") + // we can only send at fastest the 100 msg in 5 sec due the delay + .delay(50) + .inOut("activemq:queue:bar") + .to("mock:result"); + + from("activemq:queue:bar") + .log("Using ${threadName} to process ${body}") + // we can only process at fastest the 100 msg in 5 sec due the delay + .delay(50) + .transform(body().prepend("Bye ")); + } + }; + } +} diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/async/AsyncJmsProducerTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/async/AsyncJmsProducerTest.java new file mode 100644 index 0000000000000..9d72b292de3ac --- /dev/null +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/async/AsyncJmsProducerTest.java @@ -0,0 +1,90 @@ +/** + * 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.apache.camel.component.jms.async; + +import javax.jms.ConnectionFactory; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge; + +/** + * @version $Revision$ + */ +public class AsyncJmsProducerTest extends CamelTestSupport { + + private static String beforeThreadName; + private static String afterThreadName; + + @Test + public void testAsyncEndpoint() throws Exception { + getMockEndpoint("mock:before").expectedBodiesReceived("Hello Camel"); + getMockEndpoint("mock:after").expectedBodiesReceived("Bye Camel"); + getMockEndpoint("mock:result").expectedBodiesReceived("Bye Camel"); + + String reply = template.requestBody("direct:start", "Hello Camel", String.class); + assertEquals("Bye Camel", reply); + + assertMockEndpointsSatisfied(); + + assertFalse("Should use different threads", beforeThreadName.equalsIgnoreCase(afterThreadName)); + } + + protected CamelContext createCamelContext() throws Exception { + CamelContext camelContext = super.createCamelContext(); + + ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); + camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory)); + + return camelContext; + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start") + .to("mock:before") + .to("log:before") + .process(new Processor() { + public void process(Exchange exchange) throws Exception { + beforeThreadName = Thread.currentThread().getName(); + } + }) + .to("activemq:queue:foo") + .process(new Processor() { + public void process(Exchange exchange) throws Exception { + afterThreadName = Thread.currentThread().getName(); + } + }) + .to("log:after") + .to("mock:after") + .to("mock:result"); + + from("activemq:queue:foo") + .transform(constant("Bye Camel")); + } + }; + } +} diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutIssueTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutIssueTest.java index 342cbe780976c..1e02701540bbb 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutIssueTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutIssueTest.java @@ -27,6 +27,7 @@ import org.junit.Test; import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent; + /** * @version $Revision$ */ @@ -38,6 +39,15 @@ public void testInOutWithRequestBody() throws Exception { assertEquals("Bye World", reply); } + @Test + public void testInOutTwoTimes() throws Exception { + String reply = template.requestBody("activemq:queue:in", "Hello World", String.class); + assertEquals("Bye World", reply); + + reply = template.requestBody("activemq:queue:in", "Hello Camel", String.class); + assertEquals("Bye World", reply); + } + @Test public void testInOutWithAsyncRequestBody() throws Exception { Future<String> reply = template.asyncRequestBody("activemq:queue:in", "Hello World", String.class); diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutUseMessageIDasCorrelationIDTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutUseMessageIDasCorrelationIDTest.java new file mode 100644 index 0000000000000..403dc7424131b --- /dev/null +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutUseMessageIDasCorrelationIDTest.java @@ -0,0 +1,66 @@ +/** + * 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.apache.camel.component.jms.issues; + +import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +import static org.apache.activemq.camel.component.ActiveMQComponent.activeMQComponent; + +/** + * @version $Revision$ + */ +public class JmsInOutUseMessageIDasCorrelationIDTest extends CamelTestSupport { + + @Test + public void testInOutWithMsgIdAsCorrId() throws Exception { + String reply = template.requestBody("activemq:queue:in?useMessageIDAsCorrelationID=true", "Hello World", String.class); + assertEquals("Bye World", reply); + } + + @Test + public void testInOutFixedReplyToAndWithMsgIdAsCorrId() throws Exception { + String reply = template.requestBody("activemq:queue:in?replyTo=bar&useMessageIDAsCorrelationID=true", "Hello World", String.class); + assertEquals("Bye World", reply); + } + + protected CamelContext createCamelContext() throws Exception { + CamelContext camelContext = super.createCamelContext(); + camelContext.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false&broker.useJmx=false")); + return camelContext; + } + + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + public void configure() throws Exception { + from("activemq:queue:in?useMessageIDAsCorrelationID=true").process(new Processor() { + public void process(Exchange exchange) throws Exception { + String id = exchange.getIn().getHeader("JMSCorrelationID", String.class); + assertNull("JMSCorrelationID should be null", id); + + exchange.getOut().setBody("Bye World"); + } + }); + } + }; + } + +} \ No newline at end of file diff --git a/components/camel-jms/src/test/resources/log4j.properties b/components/camel-jms/src/test/resources/log4j.properties index bbebcddbaa2d0..1d04ba2af1587 100644 --- a/components/camel-jms/src/test/resources/log4j.properties +++ b/components/camel-jms/src/test/resources/log4j.properties @@ -37,4 +37,6 @@ log4j.logger.org.apache.camel.management=WARN log4j.logger.org.apache.camel.impl.DefaultPackageScanClassResolver=WARN #log4j.logger.org.apache.activemq.spring=WARN #log4j.logger.org.apache.camel.component.jms=TRACE +#log4j.logger.org.apache.camel.component.jms.reply.CorrelationMap=DEBUG #log4j.logger.org.apache.camel=DEBUG +#log4j.logger.org.springframework.jms.listener=TRACE diff --git a/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java index a4550d9d0836d..1eac2e525b5d4 100644 --- a/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java +++ b/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java @@ -51,9 +51,9 @@ */ public abstract class CamelTestSupport extends TestSupport { - protected CamelContext context; - protected ProducerTemplate template; - protected ConsumerTemplate consumer; + protected volatile CamelContext context; + protected volatile ProducerTemplate template; + protected volatile ConsumerTemplate consumer; private boolean useRouteBuilder = true; private Service camelContextService; diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java index 775d1c5089e1d..c6811d0b1d15e 100644 --- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java +++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java @@ -53,9 +53,9 @@ */ public abstract class CamelTestSupport extends TestSupport { - protected CamelContext context; - protected ProducerTemplate template; - protected ConsumerTemplate consumer; + protected volatile CamelContext context; + protected volatile ProducerTemplate template; + protected volatile ConsumerTemplate consumer; private boolean useRouteBuilder = true; private Service camelContextService;
90a5181501cbcf506c34a7870220f6f9a18b30df
hadoop
MAPREDUCE-2899. Replace major parts of- ApplicationSubmissionContext with a ContainerLaunchContext (Arun Murthy via- mahadev) - Merging r1170459 from trunk--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1170460 13f79535-47bb-0310-9956-ffa450edef68-
p
https://github.com/apache/hadoop
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index c27e0a9629249..135aba975b99d 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -263,6 +263,9 @@ Release 0.23.0 - Unreleased MAPREDUCE-2676. MR-279: JobHistory Job page needs reformatted. (Robert Evans via mahadev) + MAPREDUCE-2899. Replace major parts of ApplicationSubmissionContext with a + ContainerLaunchContext (Arun Murthy via mahadev) + OPTIMIZATIONS MAPREDUCE-2026. Make JobTracker.getJobCounters() and diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java index 3d4dcb5ed0e11..17cef5a26a6eb 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java @@ -579,13 +579,12 @@ private ContainerLaunchContext createContainerLaunchContext() { + remoteJobConfPath.toUri().toASCIIString()); // //////////// End of JobConf setup - // Setup DistributedCache - setupDistributedCache(remoteFS, conf, localResources, environment); + MRApps.setupDistributedCache(conf, localResources, environment); // Set local-resources and environment container.setLocalResources(localResources); - container.setEnv(environment); + container.setEnvironment(environment); // Setup up tokens Credentials taskCredentials = new Credentials(); @@ -618,7 +617,7 @@ private ContainerLaunchContext createContainerLaunchContext() { ShuffleHandler.serializeServiceData(jobToken)); container.setServiceData(serviceData); - MRApps.addToClassPath(container.getEnv(), getInitialClasspath()); + MRApps.addToClassPath(container.getEnvironment(), getInitialClasspath()); } catch (IOException e) { throw new YarnException(e); } @@ -645,7 +644,7 @@ private ContainerLaunchContext createContainerLaunchContext() { taskAttemptListener.getAddress(), remoteTask, javaHome, workDir.toString(), containerLogDir, childTmpDir, jvmID)); - MapReduceChildJVM.setVMEnv(container.getEnv(), classPaths, + MapReduceChildJVM.setVMEnv(container.getEnvironment(), classPaths, workDir.toString(), containerLogDir, nmLdLibraryPath, remoteTask, localizedApplicationTokensFile); @@ -656,116 +655,6 @@ private ContainerLaunchContext createContainerLaunchContext() { return container; } - private static long[] parseTimeStamps(String[] strs) { - if (null == strs) { - return null; - } - long[] result = new long[strs.length]; - for(int i=0; i < strs.length; ++i) { - result[i] = Long.parseLong(strs[i]); - } - return result; - } - - private void setupDistributedCache(FileSystem remoteFS, - Configuration conf, - Map<String, LocalResource> localResources, - Map<String, String> env) - throws IOException { - - // Cache archives - parseDistributedCacheArtifacts(remoteFS, localResources, env, - LocalResourceType.ARCHIVE, - DistributedCache.getCacheArchives(conf), - parseTimeStamps(DistributedCache.getArchiveTimestamps(conf)), - getFileSizes(conf, MRJobConfig.CACHE_ARCHIVES_SIZES), - DistributedCache.getArchiveVisibilities(conf), - DistributedCache.getArchiveClassPaths(conf)); - - // Cache files - parseDistributedCacheArtifacts(remoteFS, - localResources, env, - LocalResourceType.FILE, - DistributedCache.getCacheFiles(conf), - parseTimeStamps(DistributedCache.getFileTimestamps(conf)), - getFileSizes(conf, MRJobConfig.CACHE_FILES_SIZES), - DistributedCache.getFileVisibilities(conf), - DistributedCache.getFileClassPaths(conf)); - } - - // TODO - Move this to MR! - // Use TaskDistributedCacheManager.CacheFiles.makeCacheFiles(URI[], - // long[], boolean[], Path[], FileType) - private void parseDistributedCacheArtifacts( - FileSystem remoteFS, - Map<String, LocalResource> localResources, - Map<String, String> env, - LocalResourceType type, - URI[] uris, long[] timestamps, long[] sizes, boolean visibilities[], - Path[] pathsToPutOnClasspath) throws IOException { - - if (uris != null) { - // Sanity check - if ((uris.length != timestamps.length) || (uris.length != sizes.length) || - (uris.length != visibilities.length)) { - throw new IllegalArgumentException("Invalid specification for " + - "distributed-cache artifacts of type " + type + " :" + - " #uris=" + uris.length + - " #timestamps=" + timestamps.length + - " #visibilities=" + visibilities.length - ); - } - - Map<String, Path> classPaths = new HashMap<String, Path>(); - if (pathsToPutOnClasspath != null) { - for (Path p : pathsToPutOnClasspath) { - p = remoteFS.resolvePath(p.makeQualified(remoteFS.getUri(), - remoteFS.getWorkingDirectory())); - classPaths.put(p.toUri().getPath().toString(), p); - } - } - for (int i = 0; i < uris.length; ++i) { - URI u = uris[i]; - Path p = new Path(u); - p = remoteFS.resolvePath(p.makeQualified(remoteFS.getUri(), - remoteFS.getWorkingDirectory())); - // Add URI fragment or just the filename - Path name = new Path((null == u.getFragment()) - ? p.getName() - : u.getFragment()); - if (name.isAbsolute()) { - throw new IllegalArgumentException("Resource name must be relative"); - } - String linkName = name.toUri().getPath(); - localResources.put( - linkName, - BuilderUtils.newLocalResource( - p.toUri(), type, - visibilities[i] - ? LocalResourceVisibility.PUBLIC - : LocalResourceVisibility.PRIVATE, - sizes[i], timestamps[i]) - ); - if (classPaths.containsKey(u.getPath())) { - MRApps.addToClassPath(env, linkName); - } - } - } - } - - // TODO - Move this to MR! - private static long[] getFileSizes(Configuration conf, String key) { - String[] strs = conf.getStrings(key); - if (strs == null) { - return null; - } - long[] result = new long[strs.length]; - for(int i=0; i < strs.length; ++i) { - result[i] = Long.parseLong(strs[i]); - } - return result; - } - @Override public ContainerId getAssignedContainerID() { readLock.lock(); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java index 5dfa1dcfe460b..68499497ac30d 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java @@ -25,14 +25,20 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.net.URI; import java.util.Arrays; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.MRJobConfig; +import org.apache.hadoop.mapreduce.filecache.DistributedCache; import org.apache.hadoop.mapreduce.v2.MRConstants; import org.apache.hadoop.mapreduce.v2.api.records.JobId; import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId; @@ -42,12 +48,18 @@ import org.apache.hadoop.util.Shell.ShellCommandExecutor; import org.apache.hadoop.yarn.YarnException; import org.apache.hadoop.yarn.api.records.ApplicationId; +import org.apache.hadoop.yarn.api.records.LocalResource; +import org.apache.hadoop.yarn.api.records.LocalResourceType; +import org.apache.hadoop.yarn.api.records.LocalResourceVisibility; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.apache.hadoop.yarn.util.Apps; +import org.apache.hadoop.yarn.util.BuilderUtils; /** * Helper class for MR applications */ +@Private +@Unstable public class MRApps extends Apps { public static final String JOB = "job"; public static final String TASK = "task"; @@ -232,4 +244,121 @@ public static String getJobFile(Configuration conf, String user, jobId.toString() + Path.SEPARATOR + MRConstants.JOB_CONF_FILE); return jobFile.toString(); } + + + + private static long[] parseTimeStamps(String[] strs) { + if (null == strs) { + return null; + } + long[] result = new long[strs.length]; + for(int i=0; i < strs.length; ++i) { + result[i] = Long.parseLong(strs[i]); + } + return result; + } + + public static void setupDistributedCache( + Configuration conf, + Map<String, LocalResource> localResources, + Map<String, String> env) + throws IOException { + + // Cache archives + parseDistributedCacheArtifacts(conf, localResources, env, + LocalResourceType.ARCHIVE, + DistributedCache.getCacheArchives(conf), + parseTimeStamps(DistributedCache.getArchiveTimestamps(conf)), + getFileSizes(conf, MRJobConfig.CACHE_ARCHIVES_SIZES), + DistributedCache.getArchiveVisibilities(conf), + DistributedCache.getArchiveClassPaths(conf)); + + // Cache files + parseDistributedCacheArtifacts(conf, + localResources, env, + LocalResourceType.FILE, + DistributedCache.getCacheFiles(conf), + parseTimeStamps(DistributedCache.getFileTimestamps(conf)), + getFileSizes(conf, MRJobConfig.CACHE_FILES_SIZES), + DistributedCache.getFileVisibilities(conf), + DistributedCache.getFileClassPaths(conf)); + } + + // TODO - Move this to MR! + // Use TaskDistributedCacheManager.CacheFiles.makeCacheFiles(URI[], + // long[], boolean[], Path[], FileType) + private static void parseDistributedCacheArtifacts( + Configuration conf, + Map<String, LocalResource> localResources, + Map<String, String> env, + LocalResourceType type, + URI[] uris, long[] timestamps, long[] sizes, boolean visibilities[], + Path[] pathsToPutOnClasspath) throws IOException { + + if (uris != null) { + // Sanity check + if ((uris.length != timestamps.length) || (uris.length != sizes.length) || + (uris.length != visibilities.length)) { + throw new IllegalArgumentException("Invalid specification for " + + "distributed-cache artifacts of type " + type + " :" + + " #uris=" + uris.length + + " #timestamps=" + timestamps.length + + " #visibilities=" + visibilities.length + ); + } + + Map<String, Path> classPaths = new HashMap<String, Path>(); + if (pathsToPutOnClasspath != null) { + for (Path p : pathsToPutOnClasspath) { + FileSystem remoteFS = p.getFileSystem(conf); + p = remoteFS.resolvePath(p.makeQualified(remoteFS.getUri(), + remoteFS.getWorkingDirectory())); + classPaths.put(p.toUri().getPath().toString(), p); + } + } + for (int i = 0; i < uris.length; ++i) { + URI u = uris[i]; + Path p = new Path(u); + FileSystem remoteFS = p.getFileSystem(conf); + p = remoteFS.resolvePath(p.makeQualified(remoteFS.getUri(), + remoteFS.getWorkingDirectory())); + // Add URI fragment or just the filename + Path name = new Path((null == u.getFragment()) + ? p.getName() + : u.getFragment()); + if (name.isAbsolute()) { + throw new IllegalArgumentException("Resource name must be relative"); + } + String linkName = name.toUri().getPath(); + localResources.put( + linkName, + BuilderUtils.newLocalResource( + p.toUri(), type, + visibilities[i] + ? LocalResourceVisibility.PUBLIC + : LocalResourceVisibility.PRIVATE, + sizes[i], timestamps[i]) + ); + if (classPaths.containsKey(u.getPath())) { + MRApps.addToClassPath(env, linkName); + } + } + } + } + + // TODO - Move this to MR! + private static long[] getFileSizes(Configuration conf, String key) { + String[] strs = conf.getStrings(key); + if (strs == null) { + return null; + } + long[] result = new long[strs.length]; + for(int i=0; i < strs.length; ++i) { + result[i] = Long.parseLong(strs[i]); + } + return result; + } + + + } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java index fa167a0acf13d..3751646010394 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java @@ -19,7 +19,6 @@ package org.apache.hadoop.mapred; import java.io.IOException; -import java.net.URI; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; @@ -33,7 +32,6 @@ import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileContext; import org.apache.hadoop.fs.FileStatus; -import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.UnsupportedFileSystemException; import org.apache.hadoop.io.DataOutputBuffer; @@ -55,7 +53,6 @@ import org.apache.hadoop.mapreduce.TaskTrackerInfo; import org.apache.hadoop.mapreduce.TaskType; import org.apache.hadoop.mapreduce.TypeConverter; -import org.apache.hadoop.mapreduce.filecache.DistributedCache; import org.apache.hadoop.mapreduce.protocol.ClientProtocol; import org.apache.hadoop.mapreduce.security.token.delegation.DelegationTokenIdentifier; import org.apache.hadoop.mapreduce.v2.MRConstants; @@ -72,6 +69,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationState; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; +import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.hadoop.yarn.api.records.LocalResourceType; import org.apache.hadoop.yarn.api.records.LocalResourceVisibility; @@ -237,7 +235,6 @@ public JobStatus submitJob(JobID jobId, String jobSubmitDir, Credentials ts) // Construct necessary information to start the MR AM ApplicationSubmissionContext appContext = createApplicationSubmissionContext(conf, jobSubmitDir, ts); - setupDistributedCache(conf, appContext); // XXX Remove in.close(); @@ -273,16 +270,18 @@ private LocalResource createApplicationResource(FileContext fs, Path p) public ApplicationSubmissionContext createApplicationSubmissionContext( Configuration jobConf, String jobSubmitDir, Credentials ts) throws IOException { - ApplicationSubmissionContext appContext = - recordFactory.newRecordInstance(ApplicationSubmissionContext.class); ApplicationId applicationId = resMgrDelegate.getApplicationId(); - appContext.setApplicationId(applicationId); + + // Setup resource requirements Resource capability = recordFactory.newRecordInstance(Resource.class); capability.setMemory(conf.getInt(MRJobConfig.MR_AM_VMEM_MB, MRJobConfig.DEFAULT_MR_AM_VMEM_MB)); LOG.info("AppMaster capability = " + capability); - appContext.setMasterCapability(capability); + // Setup LocalResources + Map<String, LocalResource> localResources = + new HashMap<String, LocalResource>(); + Path jobConfPath = new Path(jobSubmitDir, MRConstants.JOB_CONF_FILE); URL yarnUrlForJobSubmitDir = ConverterUtils @@ -292,14 +291,11 @@ public ApplicationSubmissionContext createApplicationSubmissionContext( LOG.debug("Creating setup context, jobSubmitDir url is " + yarnUrlForJobSubmitDir); - appContext.setResource(MRConstants.JOB_SUBMIT_DIR, - yarnUrlForJobSubmitDir); - - appContext.setResourceTodo(MRConstants.JOB_CONF_FILE, + localResources.put(MRConstants.JOB_CONF_FILE, createApplicationResource(defaultFileContext, jobConfPath)); if (jobConf.get(MRJobConfig.JAR) != null) { - appContext.setResourceTodo(MRConstants.JOB_JAR, + localResources.put(MRConstants.JOB_JAR, createApplicationResource(defaultFileContext, new Path(jobSubmitDir, MRConstants.JOB_JAR))); } else { @@ -312,30 +308,21 @@ public ApplicationSubmissionContext createApplicationSubmissionContext( // TODO gross hack for (String s : new String[] { "job.split", "job.splitmetainfo", MRConstants.APPLICATION_TOKENS_FILE }) { - appContext.setResourceTodo( + localResources.put( MRConstants.JOB_SUBMIT_DIR + "/" + s, - createApplicationResource(defaultFileContext, new Path(jobSubmitDir, s))); + createApplicationResource(defaultFileContext, + new Path(jobSubmitDir, s))); } - - // TODO: Only if security is on. - List<String> fsTokens = new ArrayList<String>(); - for (Token<? extends TokenIdentifier> token : ts.getAllTokens()) { - fsTokens.add(token.encodeToUrlString()); - } - - // TODO - Remove this! - appContext.addAllFsTokens(fsTokens); - DataOutputBuffer dob = new DataOutputBuffer(); - ts.writeTokenStorageToStream(dob); - appContext.setFsTokensTodo(ByteBuffer.wrap(dob.getData(), 0, dob.getLength())); - - // Add queue information - appContext.setQueue(jobConf.get(JobContext.QUEUE_NAME, JobConf.DEFAULT_QUEUE_NAME)); - - // Add job name - appContext.setApplicationName(jobConf.get(JobContext.JOB_NAME, "N/A")); - // Add the command line + // Setup security tokens + ByteBuffer securityTokens = null; + if (UserGroupInformation.isSecurityEnabled()) { + DataOutputBuffer dob = new DataOutputBuffer(); + ts.writeTokenStorageToStream(dob); + securityTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); + } + + // Setup the command to run the AM String javaHome = "$JAVA_HOME"; Vector<CharSequence> vargs = new Vector<CharSequence>(8); vargs.add(javaHome + "/bin/java"); @@ -346,13 +333,6 @@ public ApplicationSubmissionContext createApplicationSubmissionContext( vargs.add(conf.get(MRJobConfig.MR_AM_COMMAND_OPTS, MRJobConfig.DEFAULT_MR_AM_COMMAND_OPTS)); - // Add { job jar, MR app jar } to classpath. - Map<String, String> environment = new HashMap<String, String>(); - MRApps.setInitialClasspath(environment); - MRApps.addToClassPath(environment, MRConstants.JOB_JAR); - MRApps.addToClassPath(environment, - MRConstants.YARN_MAPREDUCE_APP_JAR_PATH); - appContext.addAllEnvironment(environment); vargs.add("org.apache.hadoop.mapreduce.v2.app.MRAppMaster"); vargs.add(String.valueOf(applicationId.getClusterTimestamp())); vargs.add(String.valueOf(applicationId.getId())); @@ -370,140 +350,43 @@ public ApplicationSubmissionContext createApplicationSubmissionContext( LOG.info("Command to launch container for ApplicationMaster is : " + mergedCommand); + + // Setup the environment - Add { job jar, MR app jar } to classpath. + Map<String, String> environment = new HashMap<String, String>(); + MRApps.setInitialClasspath(environment); + MRApps.addToClassPath(environment, MRConstants.JOB_JAR); + MRApps.addToClassPath(environment, + MRConstants.YARN_MAPREDUCE_APP_JAR_PATH); - appContext.addAllCommands(vargsFinal); - // TODO: RM should get this from RPC. - appContext.setUser(UserGroupInformation.getCurrentUser().getShortUserName()); - return appContext; - } + // Parse distributed cache + MRApps.setupDistributedCache(jobConf, localResources, environment); - /** - * * TODO: Copied for now from TaskAttemptImpl.java ... fixme - * @param strs - * @return - */ - private static long[] parseTimeStamps(String[] strs) { - if (null == strs) { - return null; - } - long[] result = new long[strs.length]; - for(int i=0; i < strs.length; ++i) { - result[i] = Long.parseLong(strs[i]); - } - return result; - } + // Setup ContainerLaunchContext for AM container + ContainerLaunchContext amContainer = + recordFactory.newRecordInstance(ContainerLaunchContext.class); + amContainer.setResource(capability); // Resource (mem) required + amContainer.setLocalResources(localResources); // Local resources + amContainer.setEnvironment(environment); // Environment + amContainer.setCommands(vargsFinal); // Command for AM + amContainer.setContainerTokens(securityTokens); // Security tokens - /** - * TODO: Copied for now from TaskAttemptImpl.java ... fixme - * - * TODO: This is currently needed in YarnRunner as user code like setupJob, - * cleanupJob may need access to dist-cache. Once we separate distcache for - * maps, reduces, setup etc, this can include only a subset of artificats. - * This is also needed for uberAM case where we run everything inside AM. - */ - private void setupDistributedCache(Configuration conf, - ApplicationSubmissionContext container) throws IOException { - - // Cache archives - parseDistributedCacheArtifacts(conf, container, LocalResourceType.ARCHIVE, - DistributedCache.getCacheArchives(conf), - parseTimeStamps(DistributedCache.getArchiveTimestamps(conf)), - getFileSizes(conf, MRJobConfig.CACHE_ARCHIVES_SIZES), - DistributedCache.getArchiveVisibilities(conf), - DistributedCache.getArchiveClassPaths(conf)); - - // Cache files - parseDistributedCacheArtifacts(conf, container, LocalResourceType.FILE, - DistributedCache.getCacheFiles(conf), - parseTimeStamps(DistributedCache.getFileTimestamps(conf)), - getFileSizes(conf, MRJobConfig.CACHE_FILES_SIZES), - DistributedCache.getFileVisibilities(conf), - DistributedCache.getFileClassPaths(conf)); - } - - // TODO - Move this to MR! - // Use TaskDistributedCacheManager.CacheFiles.makeCacheFiles(URI[], long[], boolean[], Path[], FileType) - private void parseDistributedCacheArtifacts(Configuration conf, - ApplicationSubmissionContext container, LocalResourceType type, - URI[] uris, long[] timestamps, long[] sizes, boolean visibilities[], - Path[] pathsToPutOnClasspath) throws IOException { - - if (uris != null) { - // Sanity check - if ((uris.length != timestamps.length) || (uris.length != sizes.length) || - (uris.length != visibilities.length)) { - throw new IllegalArgumentException("Invalid specification for " + - "distributed-cache artifacts of type " + type + " :" + - " #uris=" + uris.length + - " #timestamps=" + timestamps.length + - " #visibilities=" + visibilities.length - ); - } - - Map<String, Path> classPaths = new HashMap<String, Path>(); - if (pathsToPutOnClasspath != null) { - for (Path p : pathsToPutOnClasspath) { - FileSystem fs = p.getFileSystem(conf); - p = p.makeQualified(fs.getUri(), fs.getWorkingDirectory()); - classPaths.put(p.toUri().getPath().toString(), p); - } - } - for (int i = 0; i < uris.length; ++i) { - URI u = uris[i]; - Path p = new Path(u); - FileSystem fs = p.getFileSystem(conf); - p = fs.resolvePath( - p.makeQualified(fs.getUri(), fs.getWorkingDirectory())); - // Add URI fragment or just the filename - Path name = new Path((null == u.getFragment()) - ? p.getName() - : u.getFragment()); - if (name.isAbsolute()) { - throw new IllegalArgumentException("Resource name must be relative"); - } - String linkName = name.toUri().getPath(); - container.setResourceTodo( - linkName, - createLocalResource( - p.toUri(), type, - visibilities[i] - ? LocalResourceVisibility.PUBLIC - : LocalResourceVisibility.PRIVATE, - sizes[i], timestamps[i]) - ); - if (classPaths.containsKey(u.getPath())) { - Map<String, String> environment = container.getAllEnvironment(); - MRApps.addToClassPath(environment, linkName); - } - } - } - } + // Set up the ApplicationSubmissionContext + ApplicationSubmissionContext appContext = + recordFactory.newRecordInstance(ApplicationSubmissionContext.class); + appContext.setApplicationId(applicationId); // ApplicationId + appContext.setUser( // User name + UserGroupInformation.getCurrentUser().getShortUserName()); + appContext.setQueue( // Queue name + jobConf.get(JobContext.QUEUE_NAME, + YarnConfiguration.DEFAULT_QUEUE_NAME)); + appContext.setApplicationName( // Job name + jobConf.get(JobContext.JOB_NAME, + YarnConfiguration.DEFAULT_APPLICATION_NAME)); + appContext.setAMContainerSpec(amContainer); // AM Container - // TODO - Move this to MR! - private static long[] getFileSizes(Configuration conf, String key) { - String[] strs = conf.getStrings(key); - if (strs == null) { - return null; - } - long[] result = new long[strs.length]; - for(int i=0; i < strs.length; ++i) { - result[i] = Long.parseLong(strs[i]); - } - return result; - } - - private LocalResource createLocalResource(URI uri, - LocalResourceType type, LocalResourceVisibility visibility, - long size, long timestamp) throws IOException { - LocalResource resource = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(LocalResource.class); - resource.setResource(ConverterUtils.getYarnUrlFromURI(uri)); - resource.setType(type); - resource.setVisibility(visibility); - resource.setSize(size); - resource.setTimestamp(timestamp); - return resource; + return appContext; } - + @Override public void setJobPriority(JobID arg0, String arg1) throws IOException, InterruptedException { diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java index 46511ca0d270c..0f1243fd9fb83 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java @@ -18,14 +18,8 @@ package org.apache.hadoop.yarn.api.records; -import java.nio.ByteBuffer; -import java.util.List; -import java.util.Map; - -import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; -import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.ClientRMProtocol; /** @@ -36,26 +30,17 @@ * <p>It includes details such as: * <ul> * <li>{@link ApplicationId} of the application.</li> - * <li> - * {@link Resource} necessary to run the <code>ApplicationMaster</code>. - * </li> * <li>Application user.</li> * <li>Application name.</li> * <li>{@link Priority} of the application.</li> - * <li>Security tokens (if security is enabled).</li> - * <li> - * {@link LocalResource} necessary for running the - * <code>ApplicationMaster</code> container such - * as binaries, jar, shared-objects, side-files etc. - * </li> * <li> - * Environment variables for the launched <code>ApplicationMaster</code> - * process. + * {@link ContainerLaunchContext} of the container in which the + * <code>ApplicationMaster</code> is executed. * </li> - * <li>Command to launch the <code>ApplicationMaster</code>.</li> * </ul> * </p> * + * @see ContainerLaunchContext * @see ClientRMProtocol#submitApplication(org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest) */ @Public @@ -143,198 +128,25 @@ public interface ApplicationSubmissionContext { public void setUser(String user); /** - * Get the <code>Resource</code> required to run the - * <code>ApplicationMaster</code>. - * @return <code>Resource</code> required to run the - * <code>ApplicationMaster</code> - */ - @Public - @Stable - public Resource getMasterCapability(); - - /** - * Set <code>Resource</code> required to run the - * <code>ApplicationMaster</code>. - * @param masterCapability <code>Resource</code> required to run the - * <code>ApplicationMaster</code> - */ - @Public - @Stable - public void setMasterCapability(Resource masterCapability); - - @Private - @Unstable - public Map<String, URL> getAllResources(); - - @Private - @Unstable - public URL getResource(String key); - - @Private - @Unstable - public void addAllResources(Map<String, URL> resources); - - @Private - @Unstable - public void setResource(String key, URL url); - - @Private - @Unstable - public void removeResource(String key); - - @Private - @Unstable - public void clearResources(); - - /** - * Get all the <code>LocalResource</code> required to run the - * <code>ApplicationMaster</code>. - * @return <code>LocalResource</code> required to run the - * <code>ApplicationMaster</code> - */ - @Public - @Stable - public Map<String, LocalResource> getAllResourcesTodo(); - - @Private - @Unstable - public LocalResource getResourceTodo(String key); - - /** - * Add all the <code>LocalResource</code> required to run the - * <code>ApplicationMaster</code>. - * @param resources all <code>LocalResource</code> required to run the - * <code>ApplicationMaster</code> - */ - @Public - @Stable - public void addAllResourcesTodo(Map<String, LocalResource> resources); - - @Private - @Unstable - public void setResourceTodo(String key, LocalResource localResource); - - @Private - @Unstable - public void removeResourceTodo(String key); - - @Private - @Unstable - public void clearResourcesTodo(); - - @Private - @Unstable - public List<String> getFsTokenList(); - - @Private - @Unstable - public String getFsToken(int index); - - @Private - @Unstable - public int getFsTokenCount(); - - @Private - @Unstable - public void addAllFsTokens(List<String> fsTokens); - - @Private - @Unstable - public void addFsToken(String fsToken); - - @Private - @Unstable - public void removeFsToken(int index); - - @Private - @Unstable - public void clearFsTokens(); - - /** - * Get <em>file-system tokens</em> for the <code>ApplicationMaster</code>. - * @return file-system tokens for the <code>ApplicationMaster</code> - */ - @Public - @Stable - public ByteBuffer getFsTokensTodo(); - - /** - * Set <em>file-system tokens</em> for the <code>ApplicationMaster</code>. - * @param fsTokens file-system tokens for the <code>ApplicationMaster</code> + * Get the <code>ContainerLaunchContext</code> to describe the + * <code>Container</code> with which the <code>ApplicationMaster</code> is + * launched. + * @return <code>ContainerLaunchContext</code> for the + * <code>ApplicationMaster</code> container */ @Public @Stable - public void setFsTokensTodo(ByteBuffer fsTokens); - - /** - * Get the <em>environment variables</em> for the - * <code>ApplicationMaster</code>. - * @return environment variables for the <code>ApplicationMaster</code> - */ - @Public - @Stable - public Map<String, String> getAllEnvironment(); - - @Private - @Unstable - public String getEnvironment(String key); + public ContainerLaunchContext getAMContainerSpec(); /** - * Add all of the <em>environment variables</em> for the - * <code>ApplicationMaster</code>. - * @param environment environment variables for the - * <code>ApplicationMaster</code> + * Set the <code>ContainerLaunchContext</code> to describe the + * <code>Container</code> with which the <code>ApplicationMaster</code> is + * launched. + * @param amContainer <code>ContainerLaunchContext</code> for the + * <code>ApplicationMaster</code> container */ @Public @Stable - public void addAllEnvironment(Map<String, String> environment); + public void setAMContainerSpec(ContainerLaunchContext amContainer); - @Private - @Unstable - public void setEnvironment(String key, String env); - - @Private - @Unstable - public void removeEnvironment(String key); - - @Private - @Unstable - public void clearEnvironment(); - - /** - * Get the <em>commands</em> to launch the <code>ApplicationMaster</code>. - * @return commands to launch the <code>ApplicationMaster</code> - */ - @Public - @Stable - public List<String> getCommandList(); - - @Private - @Unstable - public String getCommand(int index); - - @Private - @Unstable - public int getCommandCount(); - - /** - * Add all of the <em>commands</em> to launch the - * <code>ApplicationMaster</code>. - * @param commands commands to launch the <code>ApplicationMaster</code> - */ - @Public - @Stable - public void addAllCommands(List<String> commands); - - @Private - @Unstable - public void addCommand(String command); - - @Private - @Unstable - public void removeCommand(int index); - - @Private - @Unstable - public void clearCommands(); } \ No newline at end of file diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java index 0339df9af1f1c..52452b54e11f0 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java @@ -156,7 +156,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - Map<String, String> getEnv(); + Map<String, String> getEnvironment(); /** * Add <em>environment variables</em> for the container. @@ -164,7 +164,7 @@ public interface ContainerLaunchContext { */ @Public @Stable - void setEnv(Map<String, String> environment); + void setEnvironment(Map<String, String> environment); /** * Get the list of <em>commands</em> for launching the container. diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java index 2b4841888a720..1f8b5c24b1f94 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java @@ -18,56 +18,35 @@ package org.apache.hadoop.yarn.api.records.impl.pb; - -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; -import org.apache.hadoop.yarn.api.records.LocalResource; +import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.Priority; import org.apache.hadoop.yarn.api.records.ProtoBase; -import org.apache.hadoop.yarn.api.records.Resource; -import org.apache.hadoop.yarn.api.records.URL; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationSubmissionContextProto; import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationSubmissionContextProtoOrBuilder; -import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceProto; +import org.apache.hadoop.yarn.proto.YarnProtos.ContainerLaunchContextProto; import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto; -import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; -import org.apache.hadoop.yarn.proto.YarnProtos.StringLocalResourceMapProto; -import org.apache.hadoop.yarn.proto.YarnProtos.StringStringMapProto; -import org.apache.hadoop.yarn.proto.YarnProtos.StringURLMapProto; -import org.apache.hadoop.yarn.proto.YarnProtos.URLProto; - - -public class ApplicationSubmissionContextPBImpl extends ProtoBase<ApplicationSubmissionContextProto> implements ApplicationSubmissionContext { - ApplicationSubmissionContextProto proto = ApplicationSubmissionContextProto.getDefaultInstance(); +public class ApplicationSubmissionContextPBImpl +extends ProtoBase<ApplicationSubmissionContextProto> +implements ApplicationSubmissionContext { + ApplicationSubmissionContextProto proto = + ApplicationSubmissionContextProto.getDefaultInstance(); ApplicationSubmissionContextProto.Builder builder = null; boolean viaProto = false; private ApplicationId applicationId = null; - private Resource masterCapability = null; - private Map<String, URL> resources = null; - private Map<String, LocalResource> resourcesTodo = null; - private List<String> fsTokenList = null; - private ByteBuffer fsTokenTodo = null; - private Map<String, String> environment = null; - private List<String> commandList = null; private Priority priority = null; - - + private ContainerLaunchContext amContainer = null; public ApplicationSubmissionContextPBImpl() { builder = ApplicationSubmissionContextProto.newBuilder(); } - public ApplicationSubmissionContextPBImpl(ApplicationSubmissionContextProto proto) { + public ApplicationSubmissionContextPBImpl( + ApplicationSubmissionContextProto proto) { this.proto = proto; viaProto = true; } @@ -83,30 +62,12 @@ private void mergeLocalToBuilder() { if (this.applicationId != null) { builder.setApplicationId(convertToProtoFormat(this.applicationId)); } - if (this.masterCapability != null) { - builder.setMasterCapability(convertToProtoFormat(this.masterCapability)); - } - if (this.resources != null) { - addResourcesToProto(); - } - if (this.resourcesTodo != null) { - addResourcesTodoToProto(); - } - if (this.fsTokenList != null) { - addFsTokenListToProto(); - } - if (this.fsTokenTodo != null) { - builder.setFsTokensTodo(convertToProtoFormat(this.fsTokenTodo)); - } - if (this.environment != null) { - addEnvironmentToProto(); - } - if (this.commandList != null) { - addCommandsToProto(); - } if (this.priority != null) { builder.setPriority(convertToProtoFormat(this.priority)); } + if (this.amContainer != null) { + builder.setAmContainerSpec(convertToProtoFormat(this.amContainer)); + } } private void mergeLocalToProto() { @@ -145,6 +106,7 @@ public void setPriority(Priority priority) { builder.clearPriority(); this.priority = priority; } + @Override public ApplicationId getApplicationId() { ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; @@ -165,6 +127,7 @@ public void setApplicationId(ApplicationId applicationId) { builder.clearApplicationId(); this.applicationId = applicationId; } + @Override public String getApplicationName() { ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; @@ -183,403 +146,7 @@ public void setApplicationName(String applicationName) { } builder.setApplicationName((applicationName)); } - @Override - public Resource getMasterCapability() { - ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; - if (this.masterCapability != null) { - return masterCapability; - } // Else via proto - if (!p.hasMasterCapability()) { - return null; - } - masterCapability = convertFromProtoFormat(p.getMasterCapability()); - return this.masterCapability; - } - - @Override - public void setMasterCapability(Resource masterCapability) { - maybeInitBuilder(); - if (masterCapability == null) - builder.clearMasterCapability(); - this.masterCapability = masterCapability; - } - @Override - public Map<String, URL> getAllResources() { - initResources(); - return this.resources; - } - @Override - public URL getResource(String key) { - initResources(); - return this.resources.get(key); - } - - private void initResources() { - if (this.resources != null) { - return; - } - ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; - List<StringURLMapProto> mapAsList = p.getResourcesList(); - this.resources = new HashMap<String, URL>(); - - for (StringURLMapProto c : mapAsList) { - this.resources.put(c.getKey(), convertFromProtoFormat(c.getValue())); - } - } - - @Override - public void addAllResources(final Map<String, URL> resources) { - if (resources == null) - return; - initResources(); - this.resources.putAll(resources); - } - - private void addResourcesToProto() { - maybeInitBuilder(); - builder.clearResources(); - if (this.resources == null) - return; - Iterable<StringURLMapProto> iterable = new Iterable<StringURLMapProto>() { - - @Override - public Iterator<StringURLMapProto> iterator() { - return new Iterator<StringURLMapProto>() { - - Iterator<String> keyIter = resources.keySet().iterator(); - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public StringURLMapProto next() { - String key = keyIter.next(); - return StringURLMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(resources.get(key))).build(); - } - - @Override - public boolean hasNext() { - return keyIter.hasNext(); - } - }; - } - }; - builder.addAllResources(iterable); - } - @Override - public void setResource(String key, URL val) { - initResources(); - this.resources.put(key, val); - } - @Override - public void removeResource(String key) { - initResources(); - this.resources.remove(key); - } - @Override - public void clearResources() { - initResources(); - this.resources.clear(); - } - @Override - public Map<String, LocalResource> getAllResourcesTodo() { - initResourcesTodo(); - return this.resourcesTodo; - } - @Override - public LocalResource getResourceTodo(String key) { - initResourcesTodo(); - return this.resourcesTodo.get(key); - } - - private void initResourcesTodo() { - if (this.resourcesTodo != null) { - return; - } - ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; - List<StringLocalResourceMapProto> mapAsList = p.getResourcesTodoList(); - this.resourcesTodo = new HashMap<String, LocalResource>(); - - for (StringLocalResourceMapProto c : mapAsList) { - this.resourcesTodo.put(c.getKey(), convertFromProtoFormat(c.getValue())); - } - } - - @Override - public void addAllResourcesTodo(final Map<String, LocalResource> resourcesTodo) { - if (resourcesTodo == null) - return; - initResourcesTodo(); - this.resourcesTodo.putAll(resourcesTodo); - } - - private void addResourcesTodoToProto() { - maybeInitBuilder(); - builder.clearResourcesTodo(); - if (resourcesTodo == null) - return; - Iterable<StringLocalResourceMapProto> iterable = new Iterable<StringLocalResourceMapProto>() { - - @Override - public Iterator<StringLocalResourceMapProto> iterator() { - return new Iterator<StringLocalResourceMapProto>() { - - Iterator<String> keyIter = resourcesTodo.keySet().iterator(); - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public StringLocalResourceMapProto next() { - String key = keyIter.next(); - return StringLocalResourceMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(resourcesTodo.get(key))).build(); - } - - @Override - public boolean hasNext() { - return keyIter.hasNext(); - } - }; - } - }; - builder.addAllResourcesTodo(iterable); - } - @Override - public void setResourceTodo(String key, LocalResource val) { - initResourcesTodo(); - this.resourcesTodo.put(key, val); - } - @Override - public void removeResourceTodo(String key) { - initResourcesTodo(); - this.resourcesTodo.remove(key); - } - @Override - public void clearResourcesTodo() { - initResourcesTodo(); - this.resourcesTodo.clear(); - } - @Override - public List<String> getFsTokenList() { - initFsTokenList(); - return this.fsTokenList; - } - @Override - public String getFsToken(int index) { - initFsTokenList(); - return this.fsTokenList.get(index); - } - @Override - public int getFsTokenCount() { - initFsTokenList(); - return this.fsTokenList.size(); - } - - private void initFsTokenList() { - if (this.fsTokenList != null) { - return; - } - ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; - List<String> list = p.getFsTokensList(); - this.fsTokenList = new ArrayList<String>(); - - for (String c : list) { - this.fsTokenList.add(c); - } - } - - @Override - public void addAllFsTokens(final List<String> fsTokens) { - if (fsTokens == null) - return; - initFsTokenList(); - this.fsTokenList.addAll(fsTokens); - } - - private void addFsTokenListToProto() { - maybeInitBuilder(); - builder.clearFsTokens(); - builder.addAllFsTokens(this.fsTokenList); - } - - @Override - public void addFsToken(String fsTokens) { - initFsTokenList(); - this.fsTokenList.add(fsTokens); - } - @Override - public void removeFsToken(int index) { - initFsTokenList(); - this.fsTokenList.remove(index); - } - @Override - public void clearFsTokens() { - initFsTokenList(); - this.fsTokenList.clear(); - } - @Override - public ByteBuffer getFsTokensTodo() { - ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; - if (this.fsTokenTodo != null) { - return this.fsTokenTodo; - } - if (!p.hasFsTokensTodo()) { - return null; - } - this.fsTokenTodo = convertFromProtoFormat(p.getFsTokensTodo()); - return this.fsTokenTodo; - } - @Override - public void setFsTokensTodo(ByteBuffer fsTokensTodo) { - maybeInitBuilder(); - if (fsTokensTodo == null) - builder.clearFsTokensTodo(); - this.fsTokenTodo = fsTokensTodo; - } - @Override - public Map<String, String> getAllEnvironment() { - initEnvironment(); - return this.environment; - } - @Override - public String getEnvironment(String key) { - initEnvironment(); - return this.environment.get(key); - } - - private void initEnvironment() { - if (this.environment != null) { - return; - } - ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; - List<StringStringMapProto> mapAsList = p.getEnvironmentList(); - this.environment = new HashMap<String, String>(); - - for (StringStringMapProto c : mapAsList) { - this.environment.put(c.getKey(), c.getValue()); - } - } - - @Override - public void addAllEnvironment(Map<String, String> environment) { - if (environment == null) - return; - initEnvironment(); - this.environment.putAll(environment); - } - - private void addEnvironmentToProto() { - maybeInitBuilder(); - builder.clearEnvironment(); - if (environment == null) - return; - Iterable<StringStringMapProto> iterable = new Iterable<StringStringMapProto>() { - - @Override - public Iterator<StringStringMapProto> iterator() { - return new Iterator<StringStringMapProto>() { - - Iterator<String> keyIter = environment.keySet().iterator(); - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public StringStringMapProto next() { - String key = keyIter.next(); - return StringStringMapProto.newBuilder().setKey(key).setValue((environment.get(key))).build(); - } - - @Override - public boolean hasNext() { - return keyIter.hasNext(); - } - }; - } - }; - builder.addAllEnvironment(iterable); - } - @Override - public void setEnvironment(String key, String val) { - initEnvironment(); - this.environment.put(key, val); - } - @Override - public void removeEnvironment(String key) { - initEnvironment(); - this.environment.remove(key); - } - @Override - public void clearEnvironment() { - initEnvironment(); - this.environment.clear(); - } - @Override - public List<String> getCommandList() { - initCommandList(); - return this.commandList; - } - @Override - public String getCommand(int index) { - initCommandList(); - return this.commandList.get(index); - } - @Override - public int getCommandCount() { - initCommandList(); - return this.commandList.size(); - } - - private void initCommandList() { - if (this.commandList != null) { - return; - } - ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; - List<String> list = p.getCommandList(); - this.commandList = new ArrayList<String>(); - - for (String c : list) { - this.commandList.add(c); - } - } - - @Override - public void addAllCommands(final List<String> command) { - if (command == null) - return; - initCommandList(); - this.commandList.addAll(command); - } - - private void addCommandsToProto() { - maybeInitBuilder(); - builder.clearCommand(); - if (this.commandList == null) - return; - builder.addAllCommand(this.commandList); - } - @Override - public void addCommand(String command) { - initCommandList(); - this.commandList.add(command); - } - @Override - public void removeCommand(int index) { - initCommandList(); - this.commandList.remove(index); - } - @Override - public void clearCommands() { - initCommandList(); - this.commandList.clear(); - } @Override public String getQueue() { ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; @@ -598,6 +165,7 @@ public void setQueue(String queue) { } builder.setQueue((queue)); } + @Override public String getUser() { ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; @@ -617,6 +185,28 @@ public void setUser(String user) { builder.setUser((user)); } + @Override + public ContainerLaunchContext getAMContainerSpec() { + ApplicationSubmissionContextProtoOrBuilder p = viaProto ? proto : builder; + if (this.amContainer != null) { + return amContainer; + } // Else via proto + if (!p.hasAmContainerSpec()) { + return null; + } + amContainer = convertFromProtoFormat(p.getAmContainerSpec()); + return amContainer; + } + + @Override + public void setAMContainerSpec(ContainerLaunchContext amContainer) { + maybeInitBuilder(); + if (amContainer == null) { + builder.clearAmContainerSpec(); + } + this.amContainer = amContainer; + } + private PriorityPBImpl convertFromProtoFormat(PriorityProto p) { return new PriorityPBImpl(p); } @@ -633,28 +223,12 @@ private ApplicationIdProto convertToProtoFormat(ApplicationId t) { return ((ApplicationIdPBImpl)t).getProto(); } - private ResourcePBImpl convertFromProtoFormat(ResourceProto p) { - return new ResourcePBImpl(p); - } - - private ResourceProto convertToProtoFormat(Resource t) { - return ((ResourcePBImpl)t).getProto(); - } - - private URLPBImpl convertFromProtoFormat(URLProto p) { - return new URLPBImpl(p); + private ContainerLaunchContextPBImpl convertFromProtoFormat( + ContainerLaunchContextProto p) { + return new ContainerLaunchContextPBImpl(p); } - private URLProto convertToProtoFormat(URL t) { - return ((URLPBImpl)t).getProto(); + private ContainerLaunchContextProto convertToProtoFormat(ContainerLaunchContext t) { + return ((ContainerLaunchContextPBImpl)t).getProto(); } - - private LocalResourcePBImpl convertFromProtoFormat(LocalResourceProto p) { - return new LocalResourcePBImpl(p); - } - - private LocalResourceProto convertToProtoFormat(LocalResource t) { - return ((LocalResourcePBImpl)t).getProto(); - } - } diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java index 0696d8327bdda..de292ad98e02c 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java @@ -39,8 +39,6 @@ import org.apache.hadoop.yarn.proto.YarnProtos.StringLocalResourceMapProto; import org.apache.hadoop.yarn.proto.YarnProtos.StringStringMapProto; - - public class ContainerLaunchContextPBImpl extends ProtoBase<ContainerLaunchContextProto> implements ContainerLaunchContext { @@ -54,10 +52,9 @@ public class ContainerLaunchContextPBImpl private Map<String, LocalResource> localResources = null; private ByteBuffer containerTokens = null; private Map<String, ByteBuffer> serviceData = null; - private Map<String, String> env = null; + private Map<String, String> environment = null; private List<String> commands = null; - public ContainerLaunchContextPBImpl() { builder = ContainerLaunchContextProto.newBuilder(); } @@ -94,7 +91,7 @@ private void mergeLocalToBuilder() { if (this.serviceData != null) { addServiceDataToProto(); } - if (this.env != null) { + if (this.environment != null) { addEnvToProto(); } if (this.commands != null) { @@ -364,37 +361,37 @@ public boolean hasNext() { } @Override - public Map<String, String> getEnv() { + public Map<String, String> getEnvironment() { initEnv(); - return this.env; + return this.environment; } private void initEnv() { - if (this.env != null) { + if (this.environment != null) { return; } ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder; - List<StringStringMapProto> list = p.getEnvList(); - this.env = new HashMap<String, String>(); + List<StringStringMapProto> list = p.getEnvironmentList(); + this.environment = new HashMap<String, String>(); for (StringStringMapProto c : list) { - this.env.put(c.getKey(), c.getValue()); + this.environment.put(c.getKey(), c.getValue()); } } @Override - public void setEnv(final Map<String, String> env) { + public void setEnvironment(final Map<String, String> env) { if (env == null) return; initEnv(); - this.env.clear(); - this.env.putAll(env); + this.environment.clear(); + this.environment.putAll(env); } private void addEnvToProto() { maybeInitBuilder(); - builder.clearEnv(); - if (env == null) + builder.clearEnvironment(); + if (environment == null) return; Iterable<StringStringMapProto> iterable = new Iterable<StringStringMapProto>() { @@ -403,7 +400,7 @@ private void addEnvToProto() { public Iterator<StringStringMapProto> iterator() { return new Iterator<StringStringMapProto>() { - Iterator<String> keyIter = env.keySet().iterator(); + Iterator<String> keyIter = environment.keySet().iterator(); @Override public void remove() { @@ -414,7 +411,7 @@ public void remove() { public StringStringMapProto next() { String key = keyIter.next(); return StringStringMapProto.newBuilder().setKey(key).setValue( - (env.get(key))).build(); + (environment.get(key))).build(); } @Override @@ -424,7 +421,7 @@ public boolean hasNext() { }; } }; - builder.addAllEnv(iterable); + builder.addAllEnvironment(iterable); } private ResourcePBImpl convertFromProtoFormat(ResourceProto p) { diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto index 61e3d1f5b94ea..cdcd1a747b816 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto @@ -188,17 +188,11 @@ message AMResponseProto { //////////////////////////////////////////////////////////////////////// message ApplicationSubmissionContextProto { optional ApplicationIdProto application_id = 1; - optional string application_name = 2; - optional ResourceProto master_capability = 3; - repeated StringURLMapProto resources = 4; - repeated StringLocalResourceMapProto resources_todo = 5; - repeated string fs_tokens = 6; - optional bytes fs_tokens_todo = 7; - repeated StringStringMapProto environment = 8; - repeated string command = 9; - optional string queue = 10; - optional PriorityProto priority = 11; - optional string user = 12; + optional string application_name = 2 [default = "N/A"]; + optional string user = 3; + optional string queue = 4 [default = "default"]; + optional PriorityProto priority = 5; + optional ContainerLaunchContextProto am_container_spec = 6; } message YarnClusterMetricsProto { @@ -242,7 +236,7 @@ message ContainerLaunchContextProto { repeated StringLocalResourceMapProto localResources = 4; optional bytes container_tokens = 5; repeated StringBytesMapProto service_data = 6; - repeated StringStringMapProto env = 7; + repeated StringStringMapProto environment = 7; repeated string command = 8; } diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index 2169ee3e90829..ba23134170ffa 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -219,6 +219,12 @@ public class YarnConfiguration extends Configuration { RM_PREFIX + "max-completed-applications"; public static final int DEFAULT_RM_MAX_COMPLETED_APPLICATIONS = 10000; + /** Default application name */ + public static final String DEFAULT_APPLICATION_NAME = "N/A"; + + /** Default queue name */ + public static final String DEFAULT_QUEUE_NAME = "default"; + //////////////////////////////// // Node Manager Configs //////////////////////////////// diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java index 1a34247c306ab..497460d3e7d0b 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java @@ -89,7 +89,7 @@ public Integer call() { final Map<Path,String> localResources = container.getLocalizedResources(); String containerIdStr = ConverterUtils.toString(container.getContainerID()); final String user = launchContext.getUser(); - final Map<String,String> env = launchContext.getEnv(); + final Map<String,String> env = launchContext.getEnvironment(); final List<String> command = launchContext.getCommands(); int ret = -1; @@ -109,7 +109,7 @@ public Integer call() { } launchContext.setCommands(newCmds); - Map<String, String> envs = launchContext.getEnv(); + Map<String, String> envs = launchContext.getEnvironment(); Map<String, String> newEnvs = new HashMap<String, String>(envs.size()); for (Entry<String, String> entry : envs.entrySet()) { newEnvs.put( @@ -118,7 +118,7 @@ public Integer call() { ApplicationConstants.LOG_DIR_EXPANSION_VAR, containerLogDir.toUri().getPath())); } - launchContext.setEnv(newEnvs); + launchContext.setEnvironment(newEnvs); // /////////////////////////// End of variable expansion FileContext lfs = FileContext.getLocalFSFileContext(); diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java index 593d6525a6894..a31bef8af9dc5 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java @@ -71,7 +71,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEventType; -import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler; import org.apache.hadoop.yarn.service.AbstractService; @@ -90,7 +89,6 @@ public class ClientRMService extends AbstractService implements final private AtomicInteger applicationCounter = new AtomicInteger(0); final private YarnScheduler scheduler; final private RMContext rmContext; - private final AMLivelinessMonitor amLivelinessMonitor; private final RMAppManager rmAppManager; private String clientServiceBindAddress; @@ -106,7 +104,6 @@ public ClientRMService(RMContext rmContext, YarnScheduler scheduler, super(ClientRMService.class.getName()); this.scheduler = scheduler; this.rmContext = rmContext; - this.amLivelinessMonitor = rmContext.getAMLivelinessMonitor(); this.rmAppManager = rmAppManager; } @@ -195,15 +192,18 @@ public SubmitApplicationResponse submitApplication( SubmitApplicationRequest request) throws YarnRemoteException { ApplicationSubmissionContext submissionContext = request .getApplicationSubmissionContext(); - ApplicationId applicationId = null; - String user = null; + ApplicationId applicationId = submissionContext.getApplicationId(); + String user = submissionContext.getUser(); try { user = UserGroupInformation.getCurrentUser().getShortUserName(); - applicationId = submissionContext.getApplicationId(); if (rmContext.getRMApps().get(applicationId) != null) { throw new IOException("Application with id " + applicationId + " is already present! Cannot add a duplicate!"); } + + // Safety + submissionContext.setUser(user); + // This needs to be synchronous as the client can query // immediately following the submission to get the application status. // So call handle directly and do not send an event. @@ -226,6 +226,7 @@ public SubmitApplicationResponse submitApplication( return response; } + @SuppressWarnings("unchecked") @Override public FinishApplicationResponse finishApplication( FinishApplicationRequest request) throws YarnRemoteException { diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java index 9a86dfd45799a..d0cd0a7ff86c6 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java @@ -210,7 +210,9 @@ protected synchronized void checkAppNumCompletedLimit() { } } - protected synchronized void submitApplication(ApplicationSubmissionContext submissionContext) { + @SuppressWarnings("unchecked") + protected synchronized void submitApplication( + ApplicationSubmissionContext submissionContext) { ApplicationId applicationId = submissionContext.getApplicationId(); RMApp application = null; try { @@ -224,27 +226,37 @@ protected synchronized void submitApplication(ApplicationSubmissionContext submi clientTokenStr = clientToken.encodeToUrlString(); LOG.debug("Sending client token as " + clientTokenStr); } - submissionContext.setQueue(submissionContext.getQueue() == null - ? "default" : submissionContext.getQueue()); - submissionContext.setApplicationName(submissionContext - .getApplicationName() == null ? "N/A" : submissionContext - .getApplicationName()); + + // Sanity checks + if (submissionContext.getQueue() == null) { + submissionContext.setQueue(YarnConfiguration.DEFAULT_QUEUE_NAME); + } + if (submissionContext.getApplicationName() == null) { + submissionContext.setApplicationName( + YarnConfiguration.DEFAULT_APPLICATION_NAME); + } + + // Store application for recovery ApplicationStore appStore = rmContext.getApplicationsStore() .createApplicationStore(submissionContext.getApplicationId(), submissionContext); + + // Create RMApp application = new RMAppImpl(applicationId, rmContext, this.conf, submissionContext.getApplicationName(), user, submissionContext.getQueue(), submissionContext, clientTokenStr, - appStore, rmContext.getAMLivelinessMonitor(), this.scheduler, + appStore, this.scheduler, this.masterService); - if (rmContext.getRMApps().putIfAbsent(applicationId, application) != null) { + if (rmContext.getRMApps().putIfAbsent(applicationId, application) != + null) { LOG.info("Application with id " + applicationId + " is already present! Cannot add a duplicate!"); - // don't send event through dispatcher as it will be handled by app already - // present with this id. + // don't send event through dispatcher as it will be handled by app + // already present with this id. application.handle(new RMAppRejectedEvent(applicationId, - "Application with this id is already present! Cannot add a duplicate!")); + "Application with this id is already present! " + + "Cannot add a duplicate!")); } else { this.rmContext.getDispatcher().getEventHandler().handle( new RMAppEvent(applicationId, RMAppEventType.START)); diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManagerSubmitEvent.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManagerSubmitEvent.java index 99b3d77fd4b4a..495e78442808d 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManagerSubmitEvent.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManagerSubmitEvent.java @@ -18,7 +18,6 @@ package org.apache.hadoop.yarn.server.resourcemanager; -import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; public class RMAppManagerSubmitEvent extends RMAppManagerEvent { diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java index 1a10993bb08e7..b394faa85d26b 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java @@ -23,7 +23,6 @@ import java.nio.ByteBuffer; import java.security.PrivilegedAction; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -120,7 +119,8 @@ private void launch() throws IOException { + " for AM " + application.getAppAttemptId()); ContainerLaunchContext launchContext = createAMContainerLaunchContext(applicationContext, masterContainerID); - StartContainerRequest request = recordFactory.newRecordInstance(StartContainerRequest.class); + StartContainerRequest request = + recordFactory.newRecordInstance(StartContainerRequest.class); request.setContainerLaunchContext(launchContext); containerMgrProxy.startContainer(request); LOG.info("Done launching container " + application.getMasterContainer() @@ -130,7 +130,8 @@ private void launch() throws IOException { private void cleanup() throws IOException { connect(); ContainerId containerId = application.getMasterContainer().getId(); - StopContainerRequest stopRequest = recordFactory.newRecordInstance(StopContainerRequest.class); + StopContainerRequest stopRequest = + recordFactory.newRecordInstance(StopContainerRequest.class); stopRequest.setContainerId(containerId); containerMgrProxy.stopContainer(stopRequest); } @@ -145,7 +146,7 @@ private ContainerManager getContainerMgrProxy( final YarnRPC rpc = YarnRPC.create(conf); // TODO: Don't create again and again. UserGroupInformation currentUser = - UserGroupInformation.createRemoteUser("TODO"); // TODO + UserGroupInformation.createRemoteUser("yarn"); // TODO if (UserGroupInformation.isSecurityEnabled()) { ContainerToken containerToken = container.getContainerToken(); Token<ContainerTokenIdentifier> token = @@ -170,8 +171,8 @@ private ContainerLaunchContext createAMContainerLaunchContext( ContainerId containerID) throws IOException { // Construct the actual Container - ContainerLaunchContext container = recordFactory.newRecordInstance(ContainerLaunchContext.class); - container.setCommands(applicationMasterContext.getCommandList()); + ContainerLaunchContext container = + applicationMasterContext.getAMContainerSpec(); StringBuilder mergedCommand = new StringBuilder(); String failCount = Integer.toString(application.getAppAttemptId() .getAttemptId()); @@ -189,34 +190,28 @@ private ContainerLaunchContext createAMContainerLaunchContext( LOG.info("Command to launch container " + containerID + " : " + mergedCommand); - Map<String, String> environment = - applicationMasterContext.getAllEnvironment(); - environment.putAll(setupTokensInEnv(applicationMasterContext)); - container.setEnv(environment); - - // Construct the actual Container + + // Finalize the container container.setContainerId(containerID); container.setUser(applicationMasterContext.getUser()); - container.setResource(applicationMasterContext.getMasterCapability()); - container.setLocalResources(applicationMasterContext.getAllResourcesTodo()); - container.setContainerTokens(applicationMasterContext.getFsTokensTodo()); + setupTokensAndEnv(container); + return container; } - private Map<String, String> setupTokensInEnv( - ApplicationSubmissionContext asc) + private void setupTokensAndEnv( + ContainerLaunchContext container) throws IOException { - Map<String, String> env = - new HashMap<String, String>(); + Map<String, String> environment = container.getEnvironment(); if (UserGroupInformation.isSecurityEnabled()) { // TODO: Security enabled/disabled info should come from RM. Credentials credentials = new Credentials(); DataInputByteBuffer dibb = new DataInputByteBuffer(); - if (asc.getFsTokensTodo() != null) { + if (container.getContainerTokens() != null) { // TODO: Don't do this kind of checks everywhere. - dibb.reset(asc.getFsTokensTodo()); + dibb.reset(container.getContainerTokens()); credentials.readTokenStorageStream(dibb); } @@ -236,14 +231,16 @@ private Map<String, String> setupTokensInEnv( token.setService(new Text(resolvedAddr)); String appMasterTokenEncoded = token.encodeToUrlString(); LOG.debug("Putting appMaster token in env : " + appMasterTokenEncoded); - env.put(ApplicationConstants.APPLICATION_MASTER_TOKEN_ENV_NAME, + environment.put( + ApplicationConstants.APPLICATION_MASTER_TOKEN_ENV_NAME, appMasterTokenEncoded); // Add the RM token credentials.addToken(new Text(resolvedAddr), token); DataOutputBuffer dob = new DataOutputBuffer(); credentials.writeTokenStorageToStream(dob); - asc.setFsTokensTodo(ByteBuffer.wrap(dob.getData(), 0, dob.getLength())); + container.setContainerTokens( + ByteBuffer.wrap(dob.getData(), 0, dob.getLength())); ApplicationTokenIdentifier identifier = new ApplicationTokenIdentifier( application.getAppAttemptId().getApplicationId()); @@ -252,9 +249,10 @@ private Map<String, String> setupTokensInEnv( String encoded = Base64.encodeBase64URLSafeString(clientSecretKey.getEncoded()); LOG.debug("The encoded client secret-key to be put in env : " + encoded); - env.put(ApplicationConstants.APPLICATION_CLIENT_SECRET_ENV_NAME, encoded); + environment.put( + ApplicationConstants.APPLICATION_CLIENT_SECRET_ENV_NAME, + encoded); } - return env; } @SuppressWarnings("unchecked") diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java index 015c76163e458..65ee9945e29c7 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java @@ -86,7 +86,6 @@ public class RMAppImpl implements RMApp { // Mutable fields private long startTime; private long finishTime; - private AMLivelinessMonitor amLivelinessMonitor; private RMAppAttempt currentAttempt; private static final FinalTransition FINAL_TRANSITION = new FinalTransition(); @@ -163,7 +162,7 @@ RMAppEventType.KILL, new AppKilledTransition()) public RMAppImpl(ApplicationId applicationId, RMContext rmContext, Configuration config, String name, String user, String queue, ApplicationSubmissionContext submissionContext, String clientTokenStr, - ApplicationStore appStore, AMLivelinessMonitor amLivelinessMonitor, + ApplicationStore appStore, YarnScheduler scheduler, ApplicationMasterService masterService) { this.applicationId = applicationId; @@ -176,7 +175,6 @@ public RMAppImpl(ApplicationId applicationId, RMContext rmContext, this.submissionContext = submissionContext; this.clientTokenStr = clientTokenStr; this.appStore = appStore; - this.amLivelinessMonitor = amLivelinessMonitor; this.scheduler = scheduler; this.masterService = masterService; this.startTime = System.currentTimeMillis(); @@ -380,6 +378,7 @@ public void handle(RMAppEvent event) { } } + @SuppressWarnings("unchecked") private void createNewAttempt() { ApplicationAttemptId appAttemptId = Records .newRecord(ApplicationAttemptId.class); @@ -434,6 +433,7 @@ private Set<NodeId> getNodesOnWhichAttemptRan(RMAppImpl app) { return nodes; } + @SuppressWarnings("unchecked") public void transition(RMAppImpl app, RMAppEvent event) { Set<NodeId> nodes = getNodesOnWhichAttemptRan(app); for (NodeId nodeId : nodes) { diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java index 6daff1d88e766..12eca4d82f3b1 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java @@ -84,6 +84,7 @@ public class RMAppAttemptImpl implements RMAppAttempt { RMAppAttemptEvent> stateMachine; private final RMContext rmContext; + @SuppressWarnings("rawtypes") private final EventHandler eventHandler; private final YarnScheduler scheduler; private final ApplicationMasterService masterService; @@ -459,7 +460,7 @@ public void transition(RMAppAttemptImpl appAttempt, // Request a container for the AM. ResourceRequest request = BuilderUtils.newResourceRequest( AM_CONTAINER_PRIORITY, "*", appAttempt.submissionContext - .getMasterCapability(), 1); + .getAMContainerSpec().getResource(), 1); LOG.debug("About to request resources for AM of " + appAttempt.applicationAttemptId + " required " + request); diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java index 94649923cb3f5..afdec298a1dc5 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java @@ -23,7 +23,6 @@ import static org.apache.hadoop.yarn.webapp.view.JQueryUI._PROGRESSBAR_VALUE; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; -import org.apache.hadoop.yarn.util.Apps; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY; @@ -59,7 +58,8 @@ class AppsBlock extends HtmlBlock { String appId = app.getApplicationId().toString(); String trackingUrl = app.getTrackingUrl(); String ui = trackingUrl == null || trackingUrl.isEmpty() ? "UNASSIGNED" : - (app.getFinishTime() == 0 ? "ApplicationMaster" : "JobHistory"); + (app.getFinishTime() == 0 ? + "ApplicationMaster URL" : "JobHistory URL"); String percent = String.format("%.1f", app.getProgress() * 100); tbody. tr(). diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java index 901948fab706a..4be273996728b 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java @@ -29,6 +29,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; +import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEvent; import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.ApplicationMasterLauncher; @@ -81,13 +82,17 @@ public RMApp submitApp(int masterMemory) throws Exception { ApplicationId appId = resp.getApplicationId(); SubmitApplicationRequest req = Records.newRecord(SubmitApplicationRequest.class); - ApplicationSubmissionContext sub = Records.newRecord(ApplicationSubmissionContext.class); + ApplicationSubmissionContext sub = + Records.newRecord(ApplicationSubmissionContext.class); sub.setApplicationId(appId); sub.setApplicationName(""); sub.setUser(""); + ContainerLaunchContext clc = + Records.newRecord(ContainerLaunchContext.class); Resource capability = Records.newRecord(Resource.class); capability.setMemory(masterMemory); - sub.setMasterCapability(capability); + clc.setResource(capability); + sub.setAMContainerSpec(clc); req.setApplicationSubmissionContext(sub); client.submitApplication(req); diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java index bd66a6337f151..afdeb161775ae 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java @@ -18,19 +18,12 @@ package org.apache.hadoop.yarn.server.resourcemanager; -import static org.mockito.Mockito.*; -import java.util.ArrayList; import java.util.List; -import java.util.LinkedList; -import java.util.Map; import java.util.concurrent.ConcurrentMap; - import junit.framework.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.event.AsyncDispatcher; @@ -44,7 +37,6 @@ import org.apache.hadoop.yarn.security.ApplicationTokenSecretManager; import org.apache.hadoop.yarn.security.client.ClientToAMSecretManager; import org.apache.hadoop.yarn.server.resourcemanager.ApplicationMasterService; -import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.RMAppManagerEvent; import org.apache.hadoop.yarn.server.resourcemanager.RMAppManagerEventType; import org.apache.hadoop.yarn.server.resourcemanager.RMAppManager; @@ -63,8 +55,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; import org.apache.hadoop.yarn.service.Service; -import org.junit.After; -import org.junit.Before; import org.junit.Test; import com.google.common.collect.Maps; import com.google.common.collect.Lists; @@ -75,7 +65,6 @@ */ public class TestAppManager{ - private static final Log LOG = LogFactory.getLog(TestAppManager.class); private static RMAppEventType appEventType = RMAppEventType.KILL; public synchronized RMAppEventType getAppEventType() { @@ -117,10 +106,8 @@ public ConcurrentMap<ApplicationId, RMApp> getRMApps() { public class TestAppManagerDispatcher implements EventHandler<RMAppManagerEvent> { - private final RMContext rmContext; - public TestAppManagerDispatcher(RMContext rmContext) { - this.rmContext = rmContext; + public TestAppManagerDispatcher() { } @Override @@ -132,15 +119,11 @@ public void handle(RMAppManagerEvent event) { public class TestDispatcher implements EventHandler<RMAppEvent> { - private final RMContext rmContext; - - public TestDispatcher(RMContext rmContext) { - this.rmContext = rmContext; + public TestDispatcher() { } @Override public void handle(RMAppEvent event) { - ApplicationId appID = event.getApplicationId(); //RMApp rmApp = this.rmContext.getRMApps().get(appID); setAppEventType(event.getType()); System.out.println("in handle routine " + getAppEventType().toString()); @@ -178,7 +161,8 @@ public int getCompletedAppsListSize() { public void setCompletedAppsMax(int max) { super.setCompletedAppsMax(max); } - public void submitApplication(ApplicationSubmissionContext submissionContext) { + public void submitApplication( + ApplicationSubmissionContext submissionContext) { super.submitApplication(submissionContext); } } @@ -336,8 +320,9 @@ public void testRMAppRetireZeroSetting() throws Exception { } protected void setupDispatcher(RMContext rmContext, Configuration conf) { - TestDispatcher testDispatcher = new TestDispatcher(rmContext); - TestAppManagerDispatcher testAppManagerDispatcher = new TestAppManagerDispatcher(rmContext); + TestDispatcher testDispatcher = new TestDispatcher(); + TestAppManagerDispatcher testAppManagerDispatcher = + new TestAppManagerDispatcher(); rmContext.getDispatcher().register(RMAppEventType.class, testDispatcher); rmContext.getDispatcher().register(RMAppManagerEventType.class, testAppManagerDispatcher); ((Service)rmContext.getDispatcher()).init(conf); @@ -359,7 +344,8 @@ public void testRMAppSubmit() throws Exception { ApplicationId appID = MockApps.newAppID(1); RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); - ApplicationSubmissionContext context = recordFactory.newRecordInstance(ApplicationSubmissionContext.class); + ApplicationSubmissionContext context = + recordFactory.newRecordInstance(ApplicationSubmissionContext.class); context.setApplicationId(appID); setupDispatcher(rmContext, conf); @@ -367,8 +353,12 @@ public void testRMAppSubmit() throws Exception { RMApp app = rmContext.getRMApps().get(appID); Assert.assertNotNull("app is null", app); Assert.assertEquals("app id doesn't match", appID, app.getApplicationId()); - Assert.assertEquals("app name doesn't match", "N/A", app.getName()); - Assert.assertEquals("app queue doesn't match", "default", app.getQueue()); + Assert.assertEquals("app name doesn't match", + YarnConfiguration.DEFAULT_APPLICATION_NAME, + app.getName()); + Assert.assertEquals("app queue doesn't match", + YarnConfiguration.DEFAULT_QUEUE_NAME, + app.getQueue()); Assert.assertEquals("app state doesn't match", RMAppState.NEW, app.getState()); Assert.assertNotNull("app store is null", app.getApplicationStore()); diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java index 56bac77209990..56b3f4b18afa7 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java @@ -128,7 +128,7 @@ protected RMApp createNewTestApp() { RMApp application = new RMAppImpl(applicationId, rmContext, conf, name, user, queue, submissionContext, clientTokenStr, - appStore, rmContext.getAMLivelinessMonitor(), scheduler, + appStore, scheduler, masterService); testAppStartState(applicationId, user, name, queue, application); diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerTokenSecretManager.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerTokenSecretManager.java index 321489827744f..989f3483d91a2 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerTokenSecretManager.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerTokenSecretManager.java @@ -27,6 +27,8 @@ import java.net.InetSocketAddress; import java.security.PrivilegedAction; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import junit.framework.Assert; @@ -54,10 +56,10 @@ import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.ApplicationMaster; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.api.records.ContainerId; +import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.ContainerToken; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.hadoop.yarn.api.records.LocalResourceType; @@ -77,6 +79,7 @@ import org.apache.hadoop.yarn.security.ContainerTokenIdentifier; import org.apache.hadoop.yarn.security.SchedulerSecurityInfo; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; +import org.apache.hadoop.yarn.server.resourcemanager.resource.Resources; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState; @@ -137,15 +140,11 @@ public void test() throws IOException, InterruptedException { ApplicationSubmissionContext appSubmissionContext = recordFactory.newRecordInstance(ApplicationSubmissionContext.class); appSubmissionContext.setApplicationId(appID); - appSubmissionContext.setMasterCapability(recordFactory - .newRecordInstance(Resource.class)); - appSubmissionContext.getMasterCapability().setMemory(1024); -// appSubmissionContext.resources = new HashMap<String, URL>(); + ContainerLaunchContext amContainer = + recordFactory.newRecordInstance(ContainerLaunchContext.class); + amContainer.setResource(Resources.createResource(1024)); + amContainer.setCommands(Arrays.asList("sleep", "100")); appSubmissionContext.setUser("testUser"); -// appSubmissionContext.environment = new HashMap<String, String>(); -// appSubmissionContext.command = new ArrayList<String>(); - appSubmissionContext.addCommand("sleep"); - appSubmissionContext.addCommand("100"); // TODO: Use a resource to work around bugs. Today NM doesn't create local // app-dirs if there are no file to download!! @@ -162,10 +161,11 @@ public void test() throws IOException, InterruptedException { rsrc.setTimestamp(file.lastModified()); rsrc.setType(LocalResourceType.FILE); rsrc.setVisibility(LocalResourceVisibility.PRIVATE); - appSubmissionContext.setResourceTodo("testFile", rsrc); + amContainer.setLocalResources(Collections.singletonMap("testFile", rsrc)); SubmitApplicationRequest submitRequest = recordFactory .newRecordInstance(SubmitApplicationRequest.class); submitRequest.setApplicationSubmissionContext(appSubmissionContext); + appSubmissionContext.setAMContainerSpec(amContainer); resourceManager.getClientRMService().submitApplication(submitRequest); // Wait till container gets allocated for AM
af936076fdb57ab158ce924fe5d9bbb4f2dd1846
restlet-framework-java
- Renamed Representation-write(Appendable) to- append(Appendable).--
p
https://github.com/restlet/restlet-framework-java
diff --git a/build/tmpl/text/changes.txt b/build/tmpl/text/changes.txt index 5c1695ad47..eceb60d26d 100644 --- a/build/tmpl/text/changes.txt +++ b/build/tmpl/text/changes.txt @@ -33,7 +33,7 @@ Changes log convenient shortcuts. - Added ClientResource#handleInbound(...) and handleOutbound(...) method to factorize even more logic. - - Added Representation#write(Appendable) method. + - Added Representation#append(Appendable) method. - New features - Added a CookieAuthenticator class in the org.restlet.ext.crypto extension to provide customizable and secure authentication via diff --git a/modules/org.restlet.test/src/org/restlet/test/ext/oauth/MultipleUserAuthorizationServerTestCase.java b/modules/org.restlet.test/src/org/restlet/test/ext/oauth/MultipleUserAuthorizationServerTestCase.java index 6e26c57533..6849fec22a 100644 --- a/modules/org.restlet.test/src/org/restlet/test/ext/oauth/MultipleUserAuthorizationServerTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/ext/oauth/MultipleUserAuthorizationServerTestCase.java @@ -68,7 +68,8 @@ public void testMultipleServerRequests() throws Exception { int numThreads = 10; int numCalls = 50; int totCalls = (numThreads * numCalls); - List<OAuthRequest> calls = new ArrayList<OAuthRequest>(totCalls); + List<Callable<Boolean>> calls = new ArrayList<Callable<Boolean>>( + totCalls); ExecutorService es = Executors.newFixedThreadPool(numThreads); Client c = this.createClient(); Random r = new Random(); diff --git a/modules/org.restlet/src/org/restlet/representation/Representation.java b/modules/org.restlet/src/org/restlet/representation/Representation.java index df5f811150..15aa3166aa 100644 --- a/modules/org.restlet/src/org/restlet/representation/Representation.java +++ b/modules/org.restlet/src/org/restlet/representation/Representation.java @@ -217,6 +217,21 @@ public Representation(Variant variant, Tag tag) { this(variant, null, tag); } + /** + * Appends the representation to an appendable sequence of characters. This + * method is ensured to write the full content for each invocation unless it + * is a transient representation, in which case an exception is thrown.<br> + * <br> + * Note that {@link #getText()} is used by the default implementation. + * + * @param appendable + * The appendable sequence of characters. + * @throws IOException + */ + public void append(Appendable appendable) throws IOException { + appendable.append(getText()); + } + /** * Exhaust the content of the representation by reading it and silently * discarding anything read. By default, it relies on {@link #getStream()} @@ -412,6 +427,16 @@ public boolean isAvailable() { return this.available && (getSize() != 0); } + // [ifdef gwt] method uncomment + // /** + // * Converts the representation to a string value. Be careful when using + // * this method as the conversion of large content to a string fully + // * stored in memory can result in OutOfMemoryErrors being thrown. + // * + // * @return The representation as a string value. + // */ + // public abstract String getText() throws IOException; + // [ifndef gwt] method /** * Indicates if the representation content supports NIO selection. In this @@ -431,16 +456,6 @@ public boolean isSelectable() { } } - // [ifdef gwt] method uncomment - // /** - // * Converts the representation to a string value. Be careful when using - // * this method as the conversion of large content to a string fully - // * stored in memory can result in OutOfMemoryErrors being thrown. - // * - // * @return The representation as a string value. - // */ - // public abstract String getText() throws IOException; - /** * Indicates if the representation's content is transient, which means that * it can be obtained only once. This is often the case with representations @@ -594,21 +609,6 @@ public void setTransient(boolean isTransient) { this.isTransient = isTransient; } - /** - * Writes the representation to an appendable sequence of characters. This - * method is ensured to write the full content for each invocation unless it - * is a transient representation, in which case an exception is thrown.<br> - * <br> - * Note that {@link #getText()} is used by the default implementation. - * - * @param appendable - * The appendable sequence of characters. - * @throws IOException - */ - public void write(Appendable appendable) throws IOException { - appendable.append(getText()); - } - // [ifndef gwt] member /** * Writes the representation to a characters writer. This method is ensured
1ab51a08aae827b179dc7d2089f0905acf3d1fcd
kotlin
Optimize search of package part files for- JetPositionManager--
p
https://github.com/JetBrains/kotlin
diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/PositionManagerLibraryClassFileSearcher.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/PositionManagerLibraryClassFileSearcher.kt index cdecca370887d..b3a55233c9056 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/PositionManagerLibraryClassFileSearcher.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/PositionManagerLibraryClassFileSearcher.kt @@ -38,6 +38,7 @@ import org.jetbrains.kotlin.psi.JetPsiUtil import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor +import com.intellij.util.indexing.FileBasedIndex private val LOG = Logger.getInstance("org.jetbrains.kotlin.idea.debugger") @@ -115,9 +116,11 @@ private fun findPackagePartFileNamesForElement(elementAt: JetElement): List<Stri JdkScope(project, libraryEntry as JdkOrderEntry) } - val packagePartFiles = FilenameIndex.getAllFilesByExt(project, "class", scope) - .filter { it.getName().startsWith(packagePartNameWoHash) } - .map { + val packagePartFiles = FilenameIndex.getAllFilenames(project).stream().filter { + it.startsWith(packagePartNameWoHash) && it.endsWith(".class") + }.flatMap { + FilenameIndex.getVirtualFilesByName(project, it, scope).stream() + }.map { val packageFqName = file.getPackageFqName() if (packageFqName.isRoot()) { it.getNameWithoutExtension() @@ -125,7 +128,7 @@ private fun findPackagePartFileNamesForElement(elementAt: JetElement): List<Stri "${packageFqName.asString()}.${it.getNameWithoutExtension()}" } } - return packagePartFiles + return packagePartFiles.toList() } private fun render(desc: DeclarationDescriptor) = DescriptorRenderer.FQ_NAMES_IN_TYPES.render(desc) diff --git a/idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java b/idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java index 748ed8b245c3d..07ad78368becc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java +++ b/idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java @@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils; import org.jetbrains.kotlin.idea.debugger.DebuggerPackage; +import org.jetbrains.kotlin.load.kotlin.PackageClassUtils; import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils; import org.jetbrains.kotlin.psi.JetElement; import org.jetbrains.kotlin.psi.JetFile; @@ -63,12 +64,16 @@ public boolean apply(@Nullable JetFile file) { return filesWithExactName.iterator().next(); } + if (!isPackagePartClassName(className)) { + return filesWithExactName.iterator().next(); + } + JetFile file = getFileForPackagePartPrefixedName(filesWithExactName, className.getInternalName()); if (file != null) { return file; } - boolean isInLibrary = KotlinPackage.any(filesWithExactName, new Function1<JetFile, Boolean>() { + boolean isInLibrary = KotlinPackage.all(filesWithExactName, new Function1<JetFile, Boolean>() { @Override public Boolean invoke(JetFile file) { return LibraryUtil.findLibraryEntry(file.getVirtualFile(), file.getProject()) != null; @@ -91,6 +96,11 @@ public Boolean invoke(JetFile file) { return null; } + private static boolean isPackagePartClassName(JvmClassName className) { + String packageName = className.getPackageFqName().asString().replaceAll("\\.", "/"); + return className.getInternalName().startsWith(packageName + "/" + PackageClassUtils.getPackageClassName(className.getPackageFqName())); + } + @Nullable private static JetFile getFileForPackagePartPrefixedName( @NotNull Collection<JetFile> allPackageFiles,
df18e9173dfbf6aa97852a25db100294b72e6eb5
spring-framework
Revised- PersistenceExceptionTranslationInterceptor to lazily retrieve- PersistenceExceptionTranslator beans on demand--Issue: SPR-10894-
a
https://github.com/spring-projects/spring-framework
diff --git a/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java b/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java index b486dccdfaa6..bca8154dc53c 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,10 +47,12 @@ public class PersistenceExceptionTranslationInterceptor implements MethodInterceptor, BeanFactoryAware, InitializingBean { - private PersistenceExceptionTranslator persistenceExceptionTranslator; + private volatile PersistenceExceptionTranslator persistenceExceptionTranslator; private boolean alwaysTranslate = false; + private ListableBeanFactory beanFactory; + /** * Create a new PersistenceExceptionTranslationInterceptor. @@ -63,10 +65,11 @@ public PersistenceExceptionTranslationInterceptor() { /** * Create a new PersistenceExceptionTranslationInterceptor * for the given PersistenceExceptionTranslator. - * @param persistenceExceptionTranslator the PersistenceExceptionTranslator to use + * @param pet the PersistenceExceptionTranslator to use */ - public PersistenceExceptionTranslationInterceptor(PersistenceExceptionTranslator persistenceExceptionTranslator) { - setPersistenceExceptionTranslator(persistenceExceptionTranslator); + public PersistenceExceptionTranslationInterceptor(PersistenceExceptionTranslator pet) { + Assert.notNull(pet, "PersistenceExceptionTranslator must not be null"); + this.persistenceExceptionTranslator = pet; } /** @@ -76,7 +79,8 @@ public PersistenceExceptionTranslationInterceptor(PersistenceExceptionTranslator * PersistenceExceptionTranslators from */ public PersistenceExceptionTranslationInterceptor(ListableBeanFactory beanFactory) { - this.persistenceExceptionTranslator = detectPersistenceExceptionTranslators(beanFactory); + Assert.notNull(beanFactory, "ListableBeanFactory must not be null"); + this.beanFactory = beanFactory; } @@ -87,7 +91,6 @@ public PersistenceExceptionTranslationInterceptor(ListableBeanFactory beanFactor * @see #detectPersistenceExceptionTranslators */ public void setPersistenceExceptionTranslator(PersistenceExceptionTranslator pet) { - Assert.notNull(pet, "PersistenceExceptionTranslator must not be null"); this.persistenceExceptionTranslator = pet; } @@ -115,19 +118,37 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException { throw new IllegalArgumentException( "Cannot use PersistenceExceptionTranslator autodetection without ListableBeanFactory"); } - this.persistenceExceptionTranslator = - detectPersistenceExceptionTranslators((ListableBeanFactory) beanFactory); + this.beanFactory = (ListableBeanFactory) beanFactory; } } @Override public void afterPropertiesSet() { - if (this.persistenceExceptionTranslator == null) { + if (this.persistenceExceptionTranslator == null && this.beanFactory == null) { throw new IllegalArgumentException("Property 'persistenceExceptionTranslator' is required"); } } + @Override + public Object invoke(MethodInvocation mi) throws Throwable { + try { + return mi.proceed(); + } + catch (RuntimeException ex) { + // Let it throw raw if the type of the exception is on the throws clause of the method. + if (!this.alwaysTranslate && ReflectionUtils.declaresException(mi.getMethod(), ex.getClass())) { + throw ex; + } + else { + if (this.persistenceExceptionTranslator == null) { + this.persistenceExceptionTranslator = detectPersistenceExceptionTranslators(this.beanFactory); + } + throw DataAccessUtils.translateIfNecessary(ex, this.persistenceExceptionTranslator); + } + } + } + /** * Detect all PersistenceExceptionTranslators in the given BeanFactory. * @param beanFactory the ListableBeanFactory to obtaining all @@ -140,10 +161,6 @@ protected PersistenceExceptionTranslator detectPersistenceExceptionTranslators(L // Find all translators, being careful not to activate FactoryBeans. Map<String, PersistenceExceptionTranslator> pets = BeanFactoryUtils.beansOfTypeIncludingAncestors( beanFactory, PersistenceExceptionTranslator.class, false, false); - if (pets.isEmpty()) { - throw new IllegalStateException( - "No persistence exception translators found in bean factory. Cannot perform exception translation."); - } ChainedPersistenceExceptionTranslator cpet = new ChainedPersistenceExceptionTranslator(); for (PersistenceExceptionTranslator pet : pets.values()) { cpet.addDelegate(pet); @@ -151,21 +168,4 @@ protected PersistenceExceptionTranslator detectPersistenceExceptionTranslators(L return cpet; } - - @Override - public Object invoke(MethodInvocation mi) throws Throwable { - try { - return mi.proceed(); - } - catch (RuntimeException ex) { - // Let it throw raw if the type of the exception is on the throws clause of the method. - if (!this.alwaysTranslate && ReflectionUtils.declaresException(mi.getMethod(), ex.getClass())) { - throw ex; - } - else { - throw DataAccessUtils.translateIfNecessary(ex, this.persistenceExceptionTranslator); - } - } - } - } diff --git a/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessorTests.java b/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessorTests.java index fb6259de9321..ef2a0c2236a5 100644 --- a/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessorTests.java +++ b/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.springframework.dao.annotation; +import javax.persistence.PersistenceException; + import junit.framework.TestCase; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; @@ -25,38 +27,23 @@ import org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; -import org.springframework.beans.BeansException; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.GenericApplicationContext; +import org.springframework.dao.DataAccessException; +import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisorTests.RepositoryInterface; import org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisorTests.RepositoryInterfaceImpl; import org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisorTests.StereotypedRepositoryInterfaceImpl; -import org.springframework.dao.support.ChainedPersistenceExceptionTranslator; +import org.springframework.dao.support.PersistenceExceptionTranslator; import org.springframework.stereotype.Repository; /** - * Unit tests for PersistenceExceptionTranslationPostProcessor. Does not test translation; there are separate unit tests - * for the Spring AOP Advisor. Just checks whether proxying occurs correctly, as a unit test should. - * * @author Rod Johnson + * @author Juergen Hoeller */ public class PersistenceExceptionTranslationPostProcessorTests extends TestCase { - public void testFailsWithNoPersistenceExceptionTranslators() { - GenericApplicationContext gac = new GenericApplicationContext(); - gac.registerBeanDefinition("translator", - new RootBeanDefinition(PersistenceExceptionTranslationPostProcessor.class)); - gac.registerBeanDefinition("proxied", new RootBeanDefinition(StereotypedRepositoryInterfaceImpl.class)); - try { - gac.refresh(); - fail("Should fail with no translators"); - } - catch (BeansException ex) { - // Ok - } - } - public void testProxiesCorrectly() { GenericApplicationContext gac = new GenericApplicationContext(); gac.registerBeanDefinition("translator", @@ -66,8 +53,8 @@ public void testProxiesCorrectly() { gac.registerBeanDefinition("classProxied", new RootBeanDefinition(RepositoryWithoutInterface.class)); gac.registerBeanDefinition("classProxiedAndAdvised", new RootBeanDefinition(RepositoryWithoutInterfaceAndOtherwiseAdvised.class)); - gac.registerBeanDefinition("chainedTranslator", - new RootBeanDefinition(ChainedPersistenceExceptionTranslator.class)); + gac.registerBeanDefinition("myTranslator", + new RootBeanDefinition(MyPersistenceExceptionTranslator.class)); gac.registerBeanDefinition("proxyCreator", BeanDefinitionBuilder.rootBeanDefinition(AnnotationAwareAspectJAutoProxyCreator.class). addPropertyValue("order", 50).getBeanDefinition()); @@ -84,8 +71,15 @@ public void testProxiesCorrectly() { Additional rwi2 = (Additional) gac.getBean("classProxiedAndAdvised"); assertTrue(AopUtils.isAopProxy(rwi2)); - rwi2.additionalMethod(); + rwi2.additionalMethod(false); checkWillTranslateExceptions(rwi2); + try { + rwi2.additionalMethod(true); + fail("Should have thrown DataAccessResourceFailureException"); + } + catch (DataAccessResourceFailureException ex) { + assertEquals("my failure", ex.getMessage()); + } } protected void checkWillTranslateExceptions(Object o) { @@ -99,6 +93,7 @@ protected void checkWillTranslateExceptions(Object o) { fail("No translation"); } + @Repository public static class RepositoryWithoutInterface { @@ -106,19 +101,38 @@ public void nameDoesntMatter() { } } + public interface Additional { - void additionalMethod(); + void additionalMethod(boolean fail); } + public static class RepositoryWithoutInterfaceAndOtherwiseAdvised extends StereotypedRepositoryInterfaceImpl implements Additional { @Override - public void additionalMethod() { + public void additionalMethod(boolean fail) { + if (fail) { + throw new PersistenceException("my failure"); + } } } + + public static class MyPersistenceExceptionTranslator implements PersistenceExceptionTranslator { + + + @Override + public DataAccessException translateExceptionIfPossible(RuntimeException ex) { + if (ex instanceof PersistenceException) { + return new DataAccessResourceFailureException(ex.getMessage()); + } + return null; + } + } + + @Aspect public static class LogAllAspect {
b497f6ccad3eebcc6d475071bb7dd2741557d5e0
spring-framework
fixed JSR-303 Validator delegation code- (SPR-6557)--
c
https://github.com/spring-projects/spring-framework
diff --git a/org.springframework.context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java b/org.springframework.context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java index d6a28c36365e..3b286bde07a9 100644 --- a/org.springframework.context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java +++ b/org.springframework.context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java @@ -121,7 +121,7 @@ public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propert public <T> Set<ConstraintViolation<T>> validateValue( Class<T> beanType, String propertyName, Object value, Class<?>... groups) { - return this.targetValidator.validateValue(beanType, propertyName, groups); + return this.targetValidator.validateValue(beanType, propertyName, value, groups); } public BeanDescriptor getConstraintsForClass(Class<?> clazz) {
0376020ee24d9f0ad345e0839be4035f93aae944
camel
further improvements for CAMEL-133, a client can- now create an exchange on an endpoint specifying the ExchangePattern it wants- to use for an Exchange via Endpoint.createExchange(pattern)--git-svn-id: https://svn.apache.org/repos/asf/activemq/camel/trunk@572625 13f79535-47bb-0310-9956-ffa450edef68-
a
https://github.com/apache/camel
diff --git a/camel-core/src/main/java/org/apache/camel/Endpoint.java b/camel-core/src/main/java/org/apache/camel/Endpoint.java index ac5ab7693cde0..c3e8b92b01326 100644 --- a/camel-core/src/main/java/org/apache/camel/Endpoint.java +++ b/camel-core/src/main/java/org/apache/camel/Endpoint.java @@ -46,6 +46,15 @@ public interface Endpoint<E extends Exchange> { */ E createExchange(); + /** + * Create a new exchange for communicating with this endpoint + * with the specified {@link ExchangePattern} such as whether its going + * to be an {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut} exchange + * + * @param pattern the message exchange pattern for the exchange + */ + E createExchange(ExchangePattern pattern); + /** * Creates a new exchange for communicating with this exchange using the * given exchange to pre-populate the values of the headers and messages diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java index 28f3c9c6a8615..0e6144309d8ee 100644 --- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java +++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanExchange.java @@ -18,6 +18,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; /** @@ -25,8 +26,8 @@ */ public class BeanExchange extends DefaultExchange { - public BeanExchange(CamelContext context) { - super(context); + public BeanExchange(CamelContext context, ExchangePattern pattern) { + super(context, pattern); } public BeanInvocation getInvocation() { @@ -39,6 +40,6 @@ public void setInvocation(BeanInvocation invocation) { @Override public Exchange newInstance() { - return new BeanExchange(getContext()); + return new BeanExchange(getContext(), getPattern()); } } diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java b/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java index 1cf308ffd36d1..05e75e4a38aac 100644 --- a/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java +++ b/camel-core/src/main/java/org/apache/camel/component/bean/CamelInvocationHandler.java @@ -22,6 +22,7 @@ import org.apache.camel.Endpoint; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; /** * An {@link java.lang.reflect.InvocationHandler} which invokes a @@ -40,7 +41,7 @@ public CamelInvocationHandler(Endpoint endpoint, Producer producer) { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { BeanInvocation invocation = new BeanInvocation(proxy, method, args); - BeanExchange exchange = new BeanExchange(endpoint.getContext()); + BeanExchange exchange = new BeanExchange(endpoint.getContext(), ExchangePattern.InOut); exchange.setInvocation(invocation); producer.process(exchange); diff --git a/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java index ed98f7493ddfd..8de1af4b4eb55 100644 --- a/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java @@ -22,6 +22,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultConsumer; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.impl.DefaultExchange; @@ -83,12 +84,6 @@ public void stop() throws Exception { }; } - public E createExchange() { - // How can we create a specific Exchange if we are generic?? - // perhaps it would be better if we did not implement this. - return (E)new DefaultExchange(getContext()); - } - public boolean isAllowMultipleConsumers() { return allowMultipleConsumers; } diff --git a/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java index e231042743a88..522d7aa204e47 100644 --- a/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java @@ -19,6 +19,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.component.file.strategy.DefaultFileRenamer; import org.apache.camel.component.file.strategy.DeleteFileProcessStrategy; import org.apache.camel.component.file.strategy.FileProcessStrategy; @@ -85,7 +86,7 @@ public Consumer<FileExchange> createConsumer(Processor file) throws Exception { * @see org.apache.camel.Endpoint#createExchange() */ public FileExchange createExchange(File file) { - return new FileExchange(getContext(), file); + return new FileExchange(getContext(), getDefaultPattern(), file); } /** @@ -96,6 +97,10 @@ public FileExchange createExchange() { return createExchange(getFile()); } + public FileExchange createExchange(ExchangePattern pattern) { + return new FileExchange(getContext(), pattern, file); + } + public File getFile() { if (autoCreate && !file.exists()) { file.mkdirs(); diff --git a/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java b/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java index 1ce31d8652467..69ca699b87a88 100644 --- a/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java +++ b/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java @@ -18,6 +18,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; import java.io.File; @@ -30,8 +31,8 @@ public class FileExchange extends DefaultExchange { private File file; - public FileExchange(CamelContext camelContext, File file) { - super(camelContext); + public FileExchange(CamelContext camelContext, ExchangePattern pattern, File file) { + super(camelContext, pattern); setIn(new FileMessage(file)); this.file = file; } @@ -51,6 +52,6 @@ public void setFile(File file) { } public Exchange newInstance() { - return new FileExchange(getContext(), getFile()); + return new FileExchange(getContext(), getPattern(), getFile()); } } diff --git a/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java index 188802fce86a9..e759985376e4d 100644 --- a/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java @@ -23,6 +23,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -91,11 +92,15 @@ public boolean isSingleton() { } public JMXExchange createExchange(Notification notification) { - return new JMXExchange(getContext(), notification); + return new JMXExchange(getContext(), getDefaultPattern(), notification); } public JMXExchange createExchange() { - return new JMXExchange(getContext(), null); + return new JMXExchange(getContext(), getDefaultPattern(), null); + } + + public JMXExchange createExchange(ExchangePattern pattern) { + return new JMXExchange(getContext(), pattern, null); } public String getAttributeName() { diff --git a/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java b/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java index c6ea6775ce186..0287c46f00020 100644 --- a/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java +++ b/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java @@ -16,10 +16,13 @@ */ package org.apache.camel.component.jmx; -import javax.management.Notification; import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; +import javax.management.Notification; + /** * A {@link Exchange} for a jmx notification * @@ -31,10 +34,10 @@ public class JMXExchange extends DefaultExchange { * Constructor * * @param camelContext - * @param file + * @param pattern */ - public JMXExchange(CamelContext camelContext, Notification notification) { - super(camelContext); + public JMXExchange(CamelContext camelContext, ExchangePattern pattern, Notification notification) { + super(camelContext, pattern); setIn(new JMXMessage(notification)); } } diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java index bf5151719f4f1..4eadac5a64519 100644 --- a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java @@ -31,6 +31,7 @@ import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.impl.DefaultExchange; import org.apache.camel.impl.DefaultProducer; @@ -98,10 +99,6 @@ public static void expectsMessageCount(int count, MockEndpoint... endpoints) thr } } - public Exchange createExchange() { - return new DefaultExchange(getContext()); - } - public Consumer<Exchange> createConsumer(Processor processor) throws Exception { throw new UnsupportedOperationException("You cannot consume from this endpoint"); } diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java index e9e387cb6c84a..b2ce83daeb7c9 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java @@ -26,6 +26,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.impl.DefaultExchange; import org.apache.camel.impl.DefaultProducer; @@ -95,10 +96,6 @@ public Consumer createConsumer(Processor processor) throws Exception { return new SedaConsumer(this, processor); } - public Exchange createExchange() { - return new DefaultExchange(getContext()); - } - public BlockingQueue<Entry> getQueue() { return queue; } diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java index c59358f812f08..8ad695a0653a5 100644 --- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java @@ -21,6 +21,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.RuntimeCamelException; +import org.apache.camel.ExchangePattern; import org.apache.camel.component.bean.BeanExchange; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.impl.DefaultExchange; @@ -50,10 +51,6 @@ public TimerEndpoint(String fullURI, TimerComponent component, String timerName) this.timerName = timerName; } - public Exchange createExchange() { - return new DefaultExchange(getContext()); - } - public Producer<Exchange> createProducer() throws Exception { throw new RuntimeCamelException("Cannot produce to a TimerEndpoint: " + getEndpointUri()); } diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java index ca0075237acbc..6c29210ae65eb 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java @@ -16,18 +16,19 @@ */ package org.apache.camel.impl; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; - import org.apache.camel.CamelContext; import org.apache.camel.Component; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; import org.apache.camel.PollingConsumer; import org.apache.camel.util.ObjectHelper; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; + /** * A default endpoint useful for implementation inheritance * @@ -38,6 +39,7 @@ public abstract class DefaultEndpoint<E extends Exchange> implements Endpoint<E> private CamelContext context; private Component component; private ScheduledExecutorService executorService; + private ExchangePattern defaultPattern = ExchangePattern.InOnly; protected DefaultEndpoint(String endpointUri, Component component) { this(endpointUri, component.getCamelContext()); @@ -148,6 +150,22 @@ public Class<E> getExchangeType() { return null; } + public E createExchange() { + return createExchange(getDefaultPattern()); + } + + public E createExchange(ExchangePattern pattern) { + return (E) new DefaultExchange(getContext(), getDefaultPattern()); + } + + public ExchangePattern getDefaultPattern() { + return defaultPattern; + } + + public void setDefaultPattern(ExchangePattern defaultPattern) { + this.defaultPattern = defaultPattern; + } + protected ScheduledThreadPoolExecutor createExecutorService() { return new ScheduledThreadPoolExecutor(10); } diff --git a/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java index e66f8dac8328e..630344753ecef 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java @@ -22,6 +22,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; /** * An endpoint which allows exchanges to be sent into it which just invokes a @@ -43,9 +44,6 @@ public ProcessorEndpoint(String endpointUri, Component component, Processor proc this.processor = processor; } - public Exchange createExchange() { - return new DefaultExchange(getContext()); - } public Producer<Exchange> createProducer() throws Exception { return new DefaultProducer<Exchange>(this) { diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java index 3e1a797d829b5..cea67383d89dc 100644 --- a/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/file/FileExchangeTest.java @@ -20,6 +20,7 @@ import org.apache.camel.ContextTestSupport; import org.apache.camel.Exchange; import org.apache.camel.Processor; +import org.apache.camel.ExchangePattern; import org.apache.camel.processor.Pipeline; import java.io.File; @@ -30,9 +31,10 @@ */ public class FileExchangeTest extends ContextTestSupport { protected File file; + protected ExchangePattern pattern = ExchangePattern.InOnly; public void testCopy() { - FileExchange fileExchange = new FileExchange(context, file); + FileExchange fileExchange = new FileExchange(context, pattern, file); Exchange exchange = fileExchange.copy(); FileExchange copy = assertIsInstanceOf(FileExchange.class, exchange); assertEquals("File", file, copy.getFile()); @@ -41,7 +43,7 @@ public void testCopy() { } public void testCopyAfterBodyChanged() throws Exception { - FileExchange original = new FileExchange(context, file); + FileExchange original = new FileExchange(context, pattern, file); Object expectedBody = 1234; original.getIn().setBody(expectedBody); Exchange exchange = original.copy(); @@ -61,7 +63,7 @@ public void process(Exchange exchange) throws Exception { }; Pipeline pipeline = new Pipeline(Collections.singletonList(myProcessor)); - FileExchange exchange = new FileExchange(context, file); + FileExchange exchange = new FileExchange(context, pattern, file); pipeline.process(exchange.copy()); } diff --git a/camel-core/src/test/java/org/apache/camel/impl/MyExchange.java b/camel-core/src/test/java/org/apache/camel/impl/MyExchange.java index 5b752a7379c02..43f96719b968e 100644 --- a/camel-core/src/test/java/org/apache/camel/impl/MyExchange.java +++ b/camel-core/src/test/java/org/apache/camel/impl/MyExchange.java @@ -17,13 +17,14 @@ package org.apache.camel.impl; import org.apache.camel.CamelContext; +import org.apache.camel.ExchangePattern; /** * @version $Revision: 1.1 $ */ public class MyExchange extends DefaultExchange { - public MyExchange(CamelContext context) { - super(context); + public MyExchange(CamelContext context, ExchangePattern pattern) { + super(context, pattern); } } diff --git a/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java b/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java index 5d0fce275e0c0..93a313259aaf7 100644 --- a/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java +++ b/camel-core/src/test/java/org/apache/camel/impl/ProducerTest.java @@ -25,12 +25,14 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.TestSupport; +import org.apache.camel.ExchangePattern; /** * @version $Revision: 1.1 $ */ public class ProducerTest extends TestSupport { - private CamelContext context = new DefaultCamelContext(); + protected CamelContext context = new DefaultCamelContext(); + protected ExchangePattern pattern = ExchangePattern.InOnly; public void testUsingADerivedExchange() throws Exception { DefaultEndpoint<MyExchange> endpoint = new DefaultEndpoint<MyExchange>("foo", new DefaultComponent() { @@ -44,8 +46,9 @@ public Consumer<MyExchange> createConsumer(Processor processor) throws Exception return null; } - public MyExchange createExchange() { - return new MyExchange(getContext()); + + public MyExchange createExchange(ExchangePattern pattern) { + return new MyExchange(getContext(), pattern); } public Producer<MyExchange> createProducer() throws Exception { @@ -75,7 +78,7 @@ public void process(Exchange exchange) throws Exception { assertNotNull(actual); assertTrue("Not same exchange", actual != exchange); - MyExchange expected = new MyExchange(context); + MyExchange expected = new MyExchange(context, pattern); actual = endpoint.createExchange(expected); assertSame("Should not copy an exchange when of the correct type", expected, actual); diff --git a/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/JournalEndpoint.java b/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/JournalEndpoint.java index 6c9f37b889fa5..d8948a26f29e3 100644 --- a/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/JournalEndpoint.java +++ b/components/camel-activemq/src/main/java/org/apache/camel/component/activemq/JournalEndpoint.java @@ -30,6 +30,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.RuntimeCamelException; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultConsumer; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.impl.DefaultExchange; @@ -57,10 +58,6 @@ public JournalEndpoint(String uri, JournalComponent journalComponent, File direc this.directory = directory; } - public Exchange createExchange() { - return new DefaultExchange(getContext()); - } - public boolean isSingleton() { return true; } diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEndpoint.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEndpoint.java index ce53e51088e1d..5f9328da2e0b6 100644 --- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEndpoint.java +++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEndpoint.java @@ -26,6 +26,7 @@ import org.apache.camel.Exchange; import org.apache.camel.PollingConsumer; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; import org.apache.camel.impl.DefaultPollingEndpoint; @@ -55,10 +56,6 @@ public boolean isSingleton() { return true; } - public Exchange createExchange() { - return new DefaultExchange(getContext()); - } - public Producer createProducer() throws Exception { return new AtomProducer(this); } diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java index b6d335a4a9f4f..200608ba5e3ed 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java @@ -21,6 +21,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.message.Message; @@ -57,11 +58,15 @@ public Consumer<CxfExchange> createConsumer(Processor processor) throws Exceptio } public CxfExchange createExchange() { - return new CxfExchange(getContext(), getBinding()); + return new CxfExchange(getContext(), getDefaultPattern(), getBinding()); + } + + public CxfExchange createExchange(ExchangePattern pattern) { + return new CxfExchange(getContext(), pattern, getBinding()); } public CxfExchange createExchange(Message inMessage) { - return new CxfExchange(getContext(), getBinding(), inMessage); + return new CxfExchange(getContext(), getDefaultPattern(), getBinding(), inMessage); } public boolean isInvoker() { diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java index 962ce207f34de..52352a580d2f8 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java @@ -17,6 +17,7 @@ package org.apache.camel.component.cxf; import org.apache.camel.CamelContext; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; @@ -34,11 +35,6 @@ public class CxfExchange extends DefaultExchange { private final CxfBinding binding; private Exchange exchange; - public CxfExchange(CamelContext context, CxfBinding binding) { - super(context); - this.binding = binding; - } - public CxfExchange(CamelContext context, CxfBinding binding, Exchange exchange) { super(context); this.binding = binding; @@ -49,9 +45,13 @@ public CxfExchange(CamelContext context, CxfBinding binding, Exchange exchange) setFault(new CxfMessage(exchange.getInFaultMessage())); } - public CxfExchange(CamelContext context, CxfBinding binding, Message inMessage) { - super(context); + public CxfExchange(CamelContext context, ExchangePattern pattern, CxfBinding binding) { + super(context, pattern); this.binding = binding; + } + + public CxfExchange(CamelContext context, ExchangePattern pattern, CxfBinding binding, Message inMessage) { + this(context, pattern, binding); this.exchange = inMessage.getExchange(); setIn(new CxfMessage(inMessage)); diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java index 28ebc64196fd4..6f1829d0b2ce5 100644 --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java @@ -19,6 +19,7 @@ import java.io.ByteArrayOutputStream; import org.apache.camel.impl.ScheduledPollEndpoint; +import org.apache.camel.ExchangePattern; public abstract class RemoteFileEndpoint<T extends RemoteFileExchange> extends ScheduledPollEndpoint<T> { private RemoteFileBinding binding; @@ -34,11 +35,15 @@ protected RemoteFileBinding createRemoteFileBinding() { } public T createExchange() { - return (T) new RemoteFileExchange(getContext(), getBinding()); + return (T) new RemoteFileExchange(getContext(), getDefaultPattern(), getBinding()); + } + + public T createExchange(ExchangePattern pattern) { + return (T) new RemoteFileExchange(getContext(), pattern, getBinding()); } public T createExchange(String fullFileName, ByteArrayOutputStream outputStream) { - return (T) new RemoteFileExchange(getContext(), getBinding(), getConfiguration().getHost(), fullFileName, outputStream); + return (T) new RemoteFileExchange(getContext(), getDefaultPattern(), getBinding(), getConfiguration().getHost(), fullFileName, outputStream); } public RemoteFileBinding getBinding() { diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExchange.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExchange.java index 11a7a4bbf7723..63f71b85710ec 100644 --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExchange.java +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExchange.java @@ -19,18 +19,19 @@ import java.io.ByteArrayOutputStream; import org.apache.camel.CamelContext; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; public class RemoteFileExchange<T extends RemoteFileBinding> extends DefaultExchange { private T binding; - public RemoteFileExchange(CamelContext context, T binding) { - super(context); + public RemoteFileExchange(CamelContext context, ExchangePattern pattern, T binding) { + super(context, pattern); this.binding = binding; } - public RemoteFileExchange(CamelContext context, T binding, String host, String fullFileName, ByteArrayOutputStream outputStream) { - this(context, binding); + public RemoteFileExchange(CamelContext context, ExchangePattern pattern, T binding, String host, String fullFileName, ByteArrayOutputStream outputStream) { + this(context, pattern, binding); setIn(new RemoteFileMessage(host, fullFileName, outputStream)); } diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java b/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java index c81177b9d4b6b..bc9676e5766a0 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.http; +import org.apache.camel.ExchangePattern; + import java.io.IOException; import java.util.concurrent.ConcurrentHashMap; diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java index 4eef4b8367cbb..02d94b7a1c003 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java @@ -18,6 +18,7 @@ import org.apache.camel.PollingConsumer; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultPollingEndpoint; import javax.servlet.http.HttpServletRequest; @@ -52,8 +53,8 @@ public PollingConsumer<HttpExchange> createPollingConsumer() throws Exception { return new HttpPollingConsumer(this); } - public HttpExchange createExchange() { - return new HttpExchange(this); + public HttpExchange createExchange(ExchangePattern pattern) { + return new HttpExchange(this, pattern); } public HttpExchange createExchange(HttpServletRequest request, HttpServletResponse response) { diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpExchange.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpExchange.java index 460a9e2ba8fe1..47dcb5f1ad452 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpExchange.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpExchange.java @@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.camel.impl.DefaultExchange; +import org.apache.camel.ExchangePattern; /** * Represents a HTTP exchange which exposes the underlying HTTP abtractions via @@ -32,19 +33,18 @@ public class HttpExchange extends DefaultExchange { private HttpServletRequest request; private HttpServletResponse response; - public HttpExchange(HttpEndpoint endpoint) { - super(endpoint.getContext()); + public HttpExchange(HttpEndpoint endpoint, ExchangePattern pattern) { + super(endpoint.getContext(), pattern); this.endpoint = endpoint; } public HttpExchange(HttpEndpoint endpoint, HttpServletRequest request, HttpServletResponse response) { - this(endpoint); + this(endpoint, getPatternFromRequest(request)); this.request = request; this.response = response; setIn(new HttpMessage(this, request)); } - /** * Returns the underlying Servlet request for inbound HTTP requests * @@ -66,4 +66,9 @@ public HttpServletResponse getResponse() { public HttpEndpoint getEndpoint() { return endpoint; } + + protected static ExchangePattern getPatternFromRequest(HttpServletRequest request) { + // TODO for now just default to InOut? + return ExchangePattern.InOut; + } } diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java index ee2be6780e9ba..ebadecae19142 100644 --- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java +++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java @@ -17,6 +17,7 @@ package org.apache.camel.component.irc; import org.apache.camel.Processor; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.schwering.irc.lib.IRCModeParser; import org.schwering.irc.lib.IRCUser; @@ -41,40 +42,40 @@ public boolean isSingleton() { return true; } - public IrcExchange createExchange() { - return new IrcExchange(getContext(), getBinding()); + public IrcExchange createExchange(ExchangePattern pattern) { + return new IrcExchange(getContext(), pattern, getBinding()); } public IrcExchange createOnPrivmsgExchange(String target, IRCUser user, String msg) { - return new IrcExchange(getContext(), getBinding(), new IrcMessage("PRIVMSG", target, user, msg)); + return new IrcExchange(getContext(), getDefaultPattern(), getBinding(), new IrcMessage("PRIVMSG", target, user, msg)); } public IrcExchange createOnNickExchange(IRCUser user, String newNick) { - return new IrcExchange(getContext(), getBinding(), new IrcMessage("NICK", user, newNick)); + return new IrcExchange(getContext(), getDefaultPattern(), getBinding(), new IrcMessage("NICK", user, newNick)); } public IrcExchange createOnQuitExchange(IRCUser user, String msg) { - return new IrcExchange(getContext(), getBinding(), new IrcMessage("QUIT", user, msg)); + return new IrcExchange(getContext(), getDefaultPattern(), getBinding(), new IrcMessage("QUIT", user, msg)); } public IrcExchange createOnJoinExchange(String channel, IRCUser user) { - return new IrcExchange(getContext(), getBinding(), new IrcMessage("JOIN", channel, user)); + return new IrcExchange(getContext(), getDefaultPattern(), getBinding(), new IrcMessage("JOIN", channel, user)); } public IrcExchange createOnKickExchange(String channel, IRCUser user, String whoWasKickedNick, String msg) { - return new IrcExchange(getContext(), getBinding(), new IrcMessage("KICK", channel, user, whoWasKickedNick, msg)); + return new IrcExchange(getContext(), getDefaultPattern(), getBinding(), new IrcMessage("KICK", channel, user, whoWasKickedNick, msg)); } public IrcExchange createOnModeExchange(String channel, IRCUser user, IRCModeParser modeParser) { - return new IrcExchange(getContext(), getBinding(), new IrcMessage("MODE", channel, user, modeParser.getLine())); + return new IrcExchange(getContext(), getDefaultPattern(), getBinding(), new IrcMessage("MODE", channel, user, modeParser.getLine())); } public IrcExchange createOnPartExchange(String channel, IRCUser user, String msg) { - return new IrcExchange(getContext(), getBinding(), new IrcMessage("PART", channel, user, msg)); + return new IrcExchange(getContext(), getDefaultPattern(), getBinding(), new IrcMessage("PART", channel, user, msg)); } public IrcExchange createOnTopicExchange(String channel, IRCUser user, String topic) { - return new IrcExchange(getContext(), getBinding(), new IrcMessage("TOPIC", channel, user, topic)); + return new IrcExchange(getContext(), getDefaultPattern(), getBinding(), new IrcMessage("TOPIC", channel, user, topic)); } public IrcProducer createProducer() throws Exception { diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcExchange.java b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcExchange.java index 9c3742fb8ed98..04a1dd8a01981 100644 --- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcExchange.java +++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcExchange.java @@ -17,18 +17,19 @@ package org.apache.camel.component.irc; import org.apache.camel.CamelContext; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; public class IrcExchange extends DefaultExchange { private IrcBinding binding; - public IrcExchange(CamelContext context, IrcBinding binding) { - super(context); + public IrcExchange(CamelContext context, ExchangePattern pattern, IrcBinding binding) { + super(context, pattern); this.binding = binding; } - public IrcExchange(CamelContext context, IrcBinding binding, IrcMessage inMessage) { - this(context, binding); + public IrcExchange(CamelContext context, ExchangePattern pattern, IrcBinding binding, IrcMessage inMessage) { + this(context, pattern, binding); setIn(inMessage); } @@ -62,7 +63,7 @@ public IrcMessage getFault() { @Override public IrcExchange newInstance() { - return new IrcExchange(getContext(), getBinding()); + return new IrcExchange(getContext(), getPattern(), getBinding()); } @Override diff --git a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java index 1ce84676da648..f03167d5dbd75 100755 --- a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java +++ b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java @@ -23,6 +23,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.RuntimeCamelException; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.impl.DefaultExchange; @@ -45,10 +46,6 @@ public boolean isSingleton() { return false; } - public DefaultExchange createExchange() { - return new DefaultExchange(getContext()); - } - public Consumer<DefaultExchange> createConsumer(Processor processor) throws Exception { throw new RuntimeCamelException("A JDBC Consumer would be the server side of database! No such support here"); } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java index 3e502edc976ab..30e11af3e6118 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java @@ -34,12 +34,12 @@ */ public class EndpointMessageListener<E extends Exchange> implements MessageListener { private static final transient Log LOG = LogFactory.getLog(EndpointMessageListener.class); - private Endpoint<E> endpoint; + private JmsEndpoint endpoint; private Processor processor; private JmsBinding binding; private boolean eagerLoadingOfProperties; - public EndpointMessageListener(Endpoint<E> endpoint, Processor processor) { + public EndpointMessageListener(JmsEndpoint endpoint, Processor processor) { this.endpoint = endpoint; this.processor = processor; } @@ -62,7 +62,7 @@ public void onMessage(Message message) { } public JmsExchange createExchange(Message message) { - return new JmsExchange(endpoint.getContext(), getBinding(), message); + return new JmsExchange(endpoint.getContext(), endpoint.getDefaultPattern(), getBinding(), message); } // Properties diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java index aca8e54b71de2..ffb882b49b368 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java @@ -20,6 +20,7 @@ import org.apache.camel.PollingConsumer; import org.apache.camel.Processor; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.springframework.jms.core.JmsOperations; @@ -90,12 +91,13 @@ public PollingConsumer<JmsExchange> createPollingConsumer() throws Exception { return new JmsPollingConsumer(this, template); } - public JmsExchange createExchange() { - return new JmsExchange(getContext(), getBinding()); + @Override + public JmsExchange createExchange(ExchangePattern pattern) { + return new JmsExchange(getContext(), pattern, getBinding()); } public JmsExchange createExchange(Message message) { - return new JmsExchange(getContext(), getBinding(), message); + return new JmsExchange(getContext(), getDefaultPattern(), getBinding(), message); } // Properties diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java index 98749aa333ecc..bf82224d979ff 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java @@ -16,28 +16,29 @@ */ package org.apache.camel.component.jms; -import javax.jms.Message; - import org.apache.camel.CamelContext; import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; +import javax.jms.Message; + /** * Represents an {@ilnk Exchange} for working with JMS messages while exposing the inbound and outbound JMS {@link Message} - * objects via {@link #getInMessage()} and {@link #getOutMessage()} + * objects via {@link #getInMessage()} and {@link #getOutMessage()} * * @version $Revision:520964 $ */ public class JmsExchange extends DefaultExchange { private JmsBinding binding; - public JmsExchange(CamelContext context, JmsBinding binding) { - super(context); + public JmsExchange(CamelContext context, ExchangePattern pattern, JmsBinding binding) { + super(context, pattern); this.binding = binding; } - public JmsExchange(CamelContext context, JmsBinding binding, Message message) { - this(context, binding); + public JmsExchange(CamelContext context, ExchangePattern pattern, JmsBinding binding, Message message) { + this(context, pattern, binding); setIn(new JmsMessage(message)); } @@ -67,7 +68,7 @@ public JmsBinding getBinding() { @Override public Exchange newInstance() { - return new JmsExchange(getContext(), binding); + return new JmsExchange(getContext(), getPattern(), binding); } // Expose JMS APIs diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java index 99ce04f3361c8..f342876fe5366 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java @@ -54,10 +54,6 @@ public JpaEndpoint(String uri, JpaComponent component) { entityManagerFactory = component.getEntityManagerFactory(); } - public Exchange createExchange() { - return new DefaultExchange(getContext()); - } - public Producer<Exchange> createProducer() throws Exception { return new JpaProducer(this, getProducerExpression()); } diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java index 5f0504cf35f85..e77c8677e2b9f 100644 --- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java +++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java @@ -22,6 +22,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.ScheduledPollEndpoint; import org.springframework.mail.javamail.JavaMailSender; @@ -78,12 +79,13 @@ public Consumer<MailExchange> createConsumer(Processor processor, Folder folder) return answer; } - public MailExchange createExchange() { - return new MailExchange(getContext(), getBinding()); + @Override + public MailExchange createExchange(ExchangePattern pattern) { + return new MailExchange(getContext(), pattern, getBinding()); } public MailExchange createExchange(Message message) { - return new MailExchange(getContext(), getBinding(), message); + return new MailExchange(getContext(), getDefaultPattern(), getBinding(), message); } // Properties diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailExchange.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailExchange.java index 06a6e18ae4bf9..a79cb849f343e 100644 --- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailExchange.java +++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailExchange.java @@ -20,6 +20,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; /** @@ -30,13 +31,13 @@ public class MailExchange extends DefaultExchange { private MailBinding binding; - public MailExchange(CamelContext context, MailBinding binding) { - super(context); + public MailExchange(CamelContext context, ExchangePattern pattern, MailBinding binding) { + super(context, pattern); this.binding = binding; } - public MailExchange(CamelContext context, MailBinding binding, Message message) { - this(context, binding); + public MailExchange(CamelContext context, ExchangePattern pattern, MailBinding binding, Message message) { + this(context, pattern, binding); setIn(new MailMessage(message)); } @@ -66,7 +67,7 @@ public MailBinding getBinding() { @Override public Exchange newInstance() { - return new MailExchange(getContext(), binding); + return new MailExchange(getContext(), getPattern(), binding); } // Expose Email APIs diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java index 43819c97bd087..7cd19023f052c 100644 --- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java +++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java @@ -21,6 +21,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.apache.mina.common.IoAcceptor; import org.apache.mina.common.IoConnector; @@ -52,12 +53,13 @@ public Consumer<MinaExchange> createConsumer(Processor processor) throws Excepti return new MinaConsumer(this, processor); } - public MinaExchange createExchange() { - return new MinaExchange(getContext()); + @Override + public MinaExchange createExchange(ExchangePattern pattern) { + return new MinaExchange(getContext(), pattern); } public MinaExchange createExchange(IoSession session, Object object) { - MinaExchange exchange = new MinaExchange(getContext()); + MinaExchange exchange = new MinaExchange(getContext(), getDefaultPattern()); exchange.getIn().setBody(object); // TODO store session in exchange? return exchange; diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaExchange.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaExchange.java index dba6214ee3619..d07313f2e14ec 100644 --- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaExchange.java +++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaExchange.java @@ -18,6 +18,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; /** @@ -27,7 +28,7 @@ */ public class MinaExchange extends DefaultExchange { - public MinaExchange(CamelContext camelContext) { + public MinaExchange(CamelContext camelContext, ExchangePattern pattern) { super(camelContext); } } diff --git a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java index 9df22a8fe9d18..b9b59c2c92080 100644 --- a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java +++ b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java @@ -22,6 +22,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.processor.loadbalancer.LoadBalancer; import org.apache.camel.processor.loadbalancer.RoundRobinLoadBalancer; @@ -117,12 +118,13 @@ public void onJobExecute(JobExecutionContext jobExecutionContext) throws JobExec } } - public QuartzExchange createExchange() { - return new QuartzExchange(getContext(), null); + @Override + public QuartzExchange createExchange(ExchangePattern pattern) { + return new QuartzExchange(getContext(), pattern, null); } public QuartzExchange createExchange(JobExecutionContext jobExecutionContext) { - return new QuartzExchange(getContext(), jobExecutionContext); + return new QuartzExchange(getContext(), getDefaultPattern(), jobExecutionContext); } public Producer<QuartzExchange> createProducer() throws Exception { diff --git a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzExchange.java b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzExchange.java index a68d64c6ff114..06002cd4e9bcb 100644 --- a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzExchange.java +++ b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzExchange.java @@ -17,6 +17,7 @@ package org.apache.camel.component.quartz; import org.apache.camel.CamelContext; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; import org.quartz.JobExecutionContext; @@ -24,8 +25,8 @@ * @version $Revision: 1.1 $ */ public class QuartzExchange extends DefaultExchange { - public QuartzExchange(CamelContext context, JobExecutionContext jobExecutionContext) { - super(context); + public QuartzExchange(CamelContext context, ExchangePattern pattern, JobExecutionContext jobExecutionContext) { + super(context, pattern); setIn(new QuartzMessage(this, jobExecutionContext)); } diff --git a/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java b/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java index 4b4049fb48f98..c433a940cff26 100644 --- a/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java +++ b/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java @@ -28,6 +28,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.RuntimeCamelException; +import org.apache.camel.ExchangePattern; import org.apache.camel.component.bean.BeanExchange; import org.apache.camel.impl.DefaultEndpoint; @@ -50,8 +51,9 @@ public boolean isSingleton() { return false; } - public BeanExchange createExchange() { - return new BeanExchange(getContext()); + @Override + public BeanExchange createExchange(ExchangePattern pattern) { + return new BeanExchange(getContext(), pattern); } public Consumer<BeanExchange> createConsumer(Processor processor) throws Exception { diff --git a/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java b/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java index 1de497ea6c127..69f6ec20b8567 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java +++ b/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java @@ -57,10 +57,6 @@ public boolean isSingleton() { return true; } - public Exchange createExchange() { - return new DefaultExchange(getContext()); - } - public Producer<Exchange> createProducer() throws Exception { return new DefaultProducer<Exchange>(this) { public void process(Exchange exchange) throws Exception { diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java index a134f3a6db556..8661736d63d7a 100644 --- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java +++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java @@ -19,6 +19,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultEndpoint; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -77,12 +78,13 @@ public Consumer<XmppExchange> createConsumer(Processor processor) throws Excepti return new XmppConsumer(this, processor); } - public XmppExchange createExchange() { - return new XmppExchange(getContext(), getBinding()); + @Override + public XmppExchange createExchange(ExchangePattern pattern) { + return new XmppExchange(getContext(), pattern, getBinding()); } public XmppExchange createExchange(Message message) { - return new XmppExchange(getContext(), getBinding(), message); + return new XmppExchange(getContext(), getDefaultPattern(), getBinding(), message); } // Properties diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppExchange.java b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppExchange.java index e38ac68f83841..1f184e157716d 100644 --- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppExchange.java +++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppExchange.java @@ -18,6 +18,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultExchange; import org.jivesoftware.smack.packet.Message; @@ -30,13 +31,13 @@ public class XmppExchange extends DefaultExchange { private XmppBinding binding; - public XmppExchange(CamelContext context, XmppBinding binding) { - super(context); + public XmppExchange(CamelContext context, ExchangePattern pattern, XmppBinding binding) { + super(context, pattern); this.binding = binding; } - public XmppExchange(CamelContext context, XmppBinding binding, Message message) { - this(context, binding); + public XmppExchange(CamelContext context, ExchangePattern pattern, XmppBinding binding, Message message) { + this(context, pattern, binding); setIn(new XmppMessage(message)); } @@ -66,7 +67,7 @@ public XmppBinding getBinding() { @Override public Exchange newInstance() { - return new XmppExchange(getContext(), binding); + return new XmppExchange(getContext(), getPattern(), binding); } // Expose the underlying XMPP APIs
e931ef7e6e360b1a89e3f0d97fbc8332852b8dcd
intellij-community
move suppress/settings intention down- (IDEA-72320 )--
c
https://github.com/JetBrains/intellij-community
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/emptyIntention/LowPriority.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/emptyIntention/LowPriority.java new file mode 100644 index 0000000000000..51882b4824e92 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/emptyIntention/LowPriority.java @@ -0,0 +1,6 @@ +class Test { + void method() { + final String i = ""; + i = "<caret>"; + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java index 3381bec67ed7f..f1d7457625e91 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java @@ -4,6 +4,7 @@ import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInspection.LocalInspectionTool; import com.intellij.codeInspection.ProblemsHolder; +import com.intellij.codeInspection.defUse.DefUseInspection; import com.intellij.psi.JavaElementVisitor; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiLiteralExpression; @@ -26,7 +27,7 @@ protected String getBasePath() { @Override protected LocalInspectionTool[] configureLocalInspectionTools() { - return new LocalInspectionTool[]{new LocalInspectionTool() { + return new LocalInspectionTool[]{new DefUseInspection(), new LocalInspectionTool() { @Override @Nls @NotNull @@ -74,4 +75,26 @@ public void testX() throws Exception { } assertEquals(1, emptyActions.size()); } + + public void testLowPriority() throws Exception { + configureByFile(getBasePath() + "/LowPriority.java"); + List<IntentionAction> emptyActions = getAvailableActions(); + int i = 0; + for(;i < emptyActions.size(); i++) { + final IntentionAction intentionAction = emptyActions.get(i); + if ("Make 'i' not final".equals(intentionAction.getText())) { + break; + } + if (intentionAction instanceof EmptyIntentionAction) { + fail("Low priority action prior to quick fix"); + } + } + assertTrue(i < emptyActions.size()); + for (; i < emptyActions.size(); i++) { + if (emptyActions.get(i) instanceof EmptyIntentionAction) { + return; + } + } + fail("Missed inspection setting action"); + } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java index 8808e65288f17..f74376b27b1d0 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java @@ -29,7 +29,7 @@ * User: anna * Date: May 11, 2005 */ -public final class EmptyIntentionAction implements IntentionAction{ +public final class EmptyIntentionAction implements IntentionAction, LowPriorityAction{ private final String myName; public EmptyIntentionAction(@NotNull String name) {
5158fe96b0f091ab52f7a5842edc447dd7f8a366
restlet-framework-java
- Fixed Message-release() Javadocs.--
p
https://github.com/restlet/restlet-framework-java
diff --git a/modules/org.restlet/src/org/restlet/Message.java b/modules/org.restlet/src/org/restlet/Message.java index 43f1d38691..64876087ea 100644 --- a/modules/org.restlet/src/org/restlet/Message.java +++ b/modules/org.restlet/src/org/restlet/Message.java @@ -328,6 +328,8 @@ public boolean isEntityAvailable() { * Releases the message's entity. If the entity is transient and hasn't been * read yet, all the remaining content will be discarded, any open socket, * channel, file or similar source of content will be immediately closed. + * + * @see org.restlet.representation.Representation#release() */ public void release() { if (getEntity() != null) {
dc41daa3db350ef9a4b14ef1d750d79cb22cf431
spring-framework
renamed 'isJava6VisibilityBridgeMethodPair' to- 'isVisibilityBridgeMethodPair' (SPR-8660)--
p
https://github.com/spring-projects/spring-framework
diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java index 5878369297a6..ae04086e3456 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java @@ -16,9 +16,6 @@ package org.springframework.beans.factory.annotation; -import static org.springframework.core.BridgeMethodResolver.findBridgedMethod; -import static org.springframework.core.BridgeMethodResolver.isJava6VisibilityBridgeMethodPair; - import java.beans.PropertyDescriptor; import java.lang.annotation.Annotation; import java.lang.reflect.AccessibleObject; @@ -38,6 +35,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.BeanUtils; import org.springframework.beans.BeansException; import org.springframework.beans.PropertyValues; @@ -52,6 +50,7 @@ import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.core.BridgeMethodResolver; import org.springframework.core.GenericTypeResolver; import org.springframework.core.MethodParameter; import org.springframework.core.Ordered; @@ -343,10 +342,9 @@ private InjectionMetadata buildAutowiringMetadata(Class<?> clazz) { } } for (Method method : targetClass.getDeclaredMethods()) { - Method bridgedMethod = findBridgedMethod(method); - Annotation annotation = isJava6VisibilityBridgeMethodPair(method, bridgedMethod) ? - findAutowiredAnnotation(bridgedMethod) : - findAutowiredAnnotation(method); + Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(method); + Annotation annotation = BridgeMethodResolver.isVisibilityBridgeMethodPair(method, bridgedMethod) ? + findAutowiredAnnotation(bridgedMethod) : findAutowiredAnnotation(method); if (annotation != null && method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) { if (Modifier.isStatic(method.getModifiers())) { if (logger.isWarnEnabled()) { diff --git a/org.springframework.core/src/main/java/org/springframework/core/BridgeMethodResolver.java b/org.springframework.core/src/main/java/org/springframework/core/BridgeMethodResolver.java index c0ff0e93b1b2..1a67089bf714 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/BridgeMethodResolver.java +++ b/org.springframework.core/src/main/java/org/springframework/core/BridgeMethodResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -218,14 +218,14 @@ private static Method searchForMatch(Class type, Method bridgeMethod) { * See also http://stas-blogspot.blogspot.com/2010/03/java-bridge-methods-explained.html * @return whether signatures match as described */ - public static boolean isJava6VisibilityBridgeMethodPair(Method bridgeMethod, Method bridgedMethod) { + public static boolean isVisibilityBridgeMethodPair(Method bridgeMethod, Method bridgedMethod) { Assert.isTrue(bridgeMethod != null); Assert.isTrue(bridgedMethod != null); if (bridgeMethod == bridgedMethod) { return true; } - return Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) - && bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType()); + return Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) && + bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType()); }
363d81c247072698e77dec6e2bb166c18d41be8b
hbase
HBASE-1447 Take last version of the hbase-1249- design doc. and make documentation out of it--git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@785081 13f79535-47bb-0310-9956-ffa450edef68-
p
https://github.com/apache/hbase
diff --git a/CHANGES.txt b/CHANGES.txt index be4364d20ce9..ec6279b9f31e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -193,6 +193,8 @@ Release 0.20.0 - Unreleased HBASE-1529 familyMap not invalidated when a Result is (re)read as a Writable HBASE-1528 Ensure scanners work across memcache snapshot + HBASE-1447 Take last version of the hbase-1249 design doc. and make + documentation out of it IMPROVEMENTS HBASE-1089 Add count of regions on filesystem to master UI; add percentage diff --git a/src/java/org/apache/hadoop/hbase/client/package-info.java b/src/java/org/apache/hadoop/hbase/client/package-info.java index 0ad66d94ef5d..5cc375e17d0a 100644 --- a/src/java/org/apache/hadoop/hbase/client/package-info.java +++ b/src/java/org/apache/hadoop/hbase/client/package-info.java @@ -35,95 +35,93 @@ <div style="background-color: #cccccc; padding: 2px"> <blockquote><pre> -REPLACE!!!!!!!! import java.io.IOException; + +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.HTable; -import org.apache.hadoop.hbase.client.Scanner; -import org.apache.hadoop.hbase.io.BatchUpdate; -import org.apache.hadoop.hbase.io.Cell; -import org.apache.hadoop.hbase.io.RowResult; +import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.client.ResultScanner; +import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.util.Bytes; -public class MyClient { - public static void main(String args[]) throws IOException { +// Class that has nothing but a main. +// Does a Put, Get and a Scan against an hbase table. +public class MyLittleHBaseClient { + public static void main(String[] args) throws IOException { // You need a configuration object to tell the client where to connect. - // But don't worry, the defaults are pulled from the local config file. + // When you create a HBaseConfiguration, it reads in whatever you've set + // into your hbase-site.xml and in hbase-default.xml, as long as these can + // be found on the CLASSPATH HBaseConfiguration config = new HBaseConfiguration(); - // This instantiates an HTable object that connects you to the "myTable" - // table. - HTable table = new HTable(config, "myTable"); - - // To do any sort of update on a row, you use an instance of the BatchUpdate - // class. A BatchUpdate takes a row and optionally a timestamp which your - // updates will affect. If no timestamp, the server applies current time - // to the edits. - BatchUpdate batchUpdate = new BatchUpdate("myRow"); - - // The BatchUpdate#put method takes a byte [] (or String) that designates - // what cell you want to put a value into, and a byte array that is the - // value you want to store. Note that if you want to store Strings, you - // have to getBytes() from the String for HBase to store it since HBase is - // all about byte arrays. The same goes for primitives like ints and longs - // and user-defined classes - you must find a way to reduce it to bytes. - // The Bytes class from the hbase util package has utility for going from - // String to utf-8 bytes and back again and help for other base types. - batchUpdate.put("myColumnFamily:columnQualifier1", - Bytes.toBytes("columnQualifier1 value!")); - - // Deletes are batch operations in HBase as well. - batchUpdate.delete("myColumnFamily:cellIWantDeleted"); - - // Once you've done all the puts you want, you need to commit the results. - // The HTable#commit method takes the BatchUpdate instance you've been - // building and pushes the batch of changes you made into HBase. - table.commit(batchUpdate); + // This instantiates an HTable object that connects you to + // the "myLittleHBaseTable" table. + HTable table = new HTable(config, "myLittleHBaseTable"); + + // To add to a row, use Put. A Put constructor takes the name of the row + // you want to insert into as a byte array. In HBase, the Bytes class has + // utility for converting all kinds of java types to byte arrays. In the + // below, we are converting the String "myLittleRow" into a byte array to + // use as a row key for our update. Once you have a Put instance, you can + // adorn it by setting the names of columns you want to update on the row, + // the timestamp to use in your update, etc.If no timestamp, the server + // applies current time to the edits. + Put p = new Put(Bytes.toBytes("myLittleRow")); + + // To set the value you'd like to update in the row 'myRow', specify the + // column family, column qualifier, and value of the table cell you'd like + // to update. The column family must already exist in your table schema. + // The qualifier can be anything. All must be specified as byte arrays as + // hbase is all about byte arrays. Lets pretend the table + // 'myLittleHBaseTable' was created with a family 'myLittleFamily'. + p.add(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier"), + Bytes.toBytes("Some Value")); + + // Once you've adorned your Put instance with all the updates you want to + // make, to commit it do the following (The HTable#put method takes the + // Put instance you've been building and pushes the changes you made into + // hbase) + table.put(p); // Now, to retrieve the data we just wrote. The values that come back are - // Cell instances. A Cell is a combination of the value as a byte array and - // the timestamp the value was stored with. If you happen to know that the - // value contained is a string and want an actual string, then you must - // convert it yourself. - Cell cell = table.get("myRow", "myColumnFamily:columnQualifier1"); - // This could throw a NullPointerException if there was no value at the cell - // location. - String valueStr = Bytes.toString(cell.getValue()); - + // Result instances. Generally, a Result is an object that will package up + // the hbase return into the form you find most palatable. + Get g = new Get(Bytes.toBytes("myLittleRow")); + Result r = table.get(g); + byte [] value = r.getValue(Bytes.toBytes("myLittleFamily"), + Bytes.toBytes("someQualifier")); + // If we convert the value bytes, we should get back 'Some Value', the + // value we inserted at this location. + String valueStr = Bytes.toString(value); + System.out.println("GET: " + valueStr); + // Sometimes, you won't know the row you're looking for. In this case, you // use a Scanner. This will give you cursor-like interface to the contents - // of the table. - Scanner scanner = - // we want to get back only "myColumnFamily:columnQualifier1" when we iterate - table.getScanner(new String[]{"myColumnFamily:columnQualifier1"}); - - - // Scanners return RowResult instances. A RowResult is like the - // row key and the columns all wrapped up in a single Object. - // RowResult#getRow gives you the row key. RowResult also implements - // Map, so you can get to your column results easily. - - // Now, for the actual iteration. One way is to use a while loop like so: - RowResult rowResult = scanner.next(); - - while (rowResult != null) { - // print out the row we found and the columns we were looking for - System.out.println("Found row: " + Bytes.toString(rowResult.getRow()) + - " with value: " + rowResult.get(Bytes.toBytes("myColumnFamily:columnQualifier1"))); - rowResult = scanner.next(); - } - - // The other approach is to use a foreach loop. Scanners are iterable! - for (RowResult result : scanner) { - // print out the row we found and the columns we were looking for - System.out.println("Found row: " + Bytes.toString(rowResult.getRow()) + - " with value: " + rowResult.get(Bytes.toBytes("myColumnFamily:columnQualifier1"))); + // of the table. To set up a Scanner, do like you did above making a Put + // and a Get, create a Scan. Adorn it with column names, etc. + Scan s = new Scan(); + s.addColumn(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier")); + ResultScanner scanner = table.getScanner(s); + try { + // Scanners return Result instances. + // Now, for the actual iteration. One way is to use a while loop like so: + for (Result rr = scanner.next(); rr != null; rr = scanner.next()) { + // print out the row we found and the columns we were looking for + System.out.println("Found row: " + rr); + } + + // The other approach is to use a foreach loop. Scanners are iterable! + // for (Result rr : scanner) { + // System.out.println("Found row: " + rr); + // } + } finally { + // Make sure you close your scanners when you are done! + // Thats why we have it inside a try/finally clause + scanner.close(); } - - // Make sure you close your scanners when you are done! - // Its probably best to put the iteration into a try/finally with the below - // inside the finally clause. - scanner.close(); } } </pre></blockquote> diff --git a/src/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java b/src/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java index b0eb92e47a79..dcd860283141 100644 --- a/src/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java +++ b/src/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java @@ -142,7 +142,7 @@ public void setHTable(HTable htable) { } /** - * @param inputColumns the columns to be placed in {@link RowResult}. + * @param inputColumns the columns to be placed in {@link Result}. */ public void setInputColumns(final byte [][] inputColumns) { this.trrInputColumns = inputColumns; @@ -304,7 +304,7 @@ public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { } /** - * @param inputColumns to be passed in {@link RowResult} to the map task. + * @param inputColumns to be passed in {@link Result} to the map task. */ protected void setInputColumns(byte [][] inputColumns) { this.inputColumns = inputColumns; diff --git a/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java b/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java index 5f063dc023b3..8a92541a0727 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java @@ -47,7 +47,6 @@ public class GetDeleteTracker implements DeleteTracker { /** * Constructor - * @param comparator */ public GetDeleteTracker() {} diff --git a/src/java/org/apache/hadoop/hbase/regionserver/MinorCompactingStoreScanner.java b/src/java/org/apache/hadoop/hbase/regionserver/MinorCompactingStoreScanner.java index 3a7b7471de6b..1c5c2660a072 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/MinorCompactingStoreScanner.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/MinorCompactingStoreScanner.java @@ -82,7 +82,7 @@ public boolean seek(KeyValue key) { /** * High performance merge scan. * @param writer - * @return + * @return True if more. * @throws IOException */ public boolean next(HFile.Writer writer) throws IOException { diff --git a/src/java/overview.html b/src/java/overview.html index db968a10077d..c871211b230b 100644 --- a/src/java/overview.html +++ b/src/java/overview.html @@ -35,6 +35,14 @@ <h2><a name="requirements">Requirements</a></h2> ssh must be installed and sshd must be running to use Hadoop's scripts to manage remote Hadoop daemons. </li> + <li>HBase depends on <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a> as of release 0.20.0. + Clients and Servers now must know where their ZooKeeper Quorum locations before + they can do anything else. + In basic standalone and pseudo-distributed modes, HBase manages a ZooKeeper instance + for you but it is required that you run a ZooKeeper Quorum when running HBase + fully distributed (More on this below). The Zookeeper addition changes + how some core HBase configuration is done. + </li> <li>HBase currently is a file handle hog. The usual default of 1024 on *nix systems is insufficient if you are loading any significant amount of data into regionservers. See the @@ -46,11 +54,6 @@ <h2><a name="requirements">Requirements</a></h2> <li>The clocks on cluster members should be in basic alignments. Some skew is tolerable but wild skew can generate odd behaviors. Run <a href="http://en.wikipedia.org/wiki/Network_Time_Protocol">NTP</a> on your cluster, or an equivalent.</li> - <li>HBase depends on <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a> as of release 0.20.0. - In basic standalone and pseudo-distributed modes, HBase manages a ZooKeeper instance - for you but it is required that you run a ZooKeeper Quorum when running HBase - fully distributed (More on this below). - </li> <li>This is a list of patches we recommend you apply to your running Hadoop cluster: <ul> <li><a hef="https://issues.apache.org/jira/browse/HADOOP-4681">HADOOP-4681 <i>"DFSClient block read failures cause open DFSInputStream to become unusable"</i></a>. This patch will help with the ever-popular, "No live nodes contain current block". @@ -86,6 +89,9 @@ <h2><a name="getting_started" >Getting Started</a></h2> see <a href="http://hadoop.apache.org/hbase/releases.html">Releases</a>, and are installing for the first time. If upgrading your HBase instance, see <a href="#upgrading">Upgrading</a>. +If you have used HBase in the past, +please read carefully. Some core configuration has changed in 0.20.x HBase. +</p> <p>Three modes are described: standalone, pseudo-distributed (where all servers are run on a single host), and distributed. If new to hbase start by following the standalone instruction. </p> diff --git a/src/test/org/apache/hadoop/hbase/regionserver/TestScanner.java b/src/test/org/apache/hadoop/hbase/regionserver/TestScanner.java index d2404226961f..23200442ced8 100644 --- a/src/test/org/apache/hadoop/hbase/regionserver/TestScanner.java +++ b/src/test/org/apache/hadoop/hbase/regionserver/TestScanner.java @@ -38,9 +38,6 @@ import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Scan; -import org.apache.hadoop.hbase.filter.StopRowFilter; -import org.apache.hadoop.hbase.filter.WhileMatchRowFilter; -import org.apache.hadoop.hbase.io.BatchUpdate; import org.apache.hadoop.hbase.io.hfile.Compression; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Writables;
eefd1c4ca69fc82c63230dfe30a5752c661388e9
spring-framework
Add context hierarchy tests to Spring MVC Test--Issue: SPR-5613-
a
https://github.com/spring-projects/spring-framework
diff --git a/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/JavaConfigTests.java b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/JavaConfigTests.java index fb75d1048f6c..63ee9376bf9f 100644 --- a/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/JavaConfigTests.java +++ b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/JavaConfigTests.java @@ -16,20 +16,21 @@ package org.springframework.test.web.servlet.samples.context; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.ContextHierarchy; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.Person; import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.samples.context.JavaConfigTests.RootConfig; import org.springframework.test.web.servlet.samples.context.JavaConfigTests.WebConfig; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; @@ -42,6 +43,13 @@ import org.springframework.web.servlet.view.tiles3.TilesConfigurer; import org.springframework.web.servlet.view.tiles3.TilesView; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import static org.mockito.Mockito.*; + + /** * Tests with Java configuration. * @@ -50,18 +58,33 @@ */ @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration("src/test/resources/META-INF/web-resources") -@ContextConfiguration(classes = WebConfig.class) +@ContextHierarchy({ + @ContextConfiguration(classes = RootConfig.class), + @ContextConfiguration(classes = WebConfig.class) +}) public class JavaConfigTests { @Autowired private WebApplicationContext wac; + @Autowired + private PersonDao personDao; + private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + when(this.personDao.getPerson(5L)).thenReturn(new Person("Joe")); + } + + @Test + public void person() throws Exception { + this.mockMvc.perform(get("/person/5").accept(MediaType.APPLICATION_JSON)) + .andDo(print()) + .andExpect(status().isOk()) + .andExpect(content().string("{\"name\":\"Joe\",\"someDouble\":0.0,\"someBoolean\":false}")); } @Test @@ -72,10 +95,27 @@ public void tilesDefinitions() throws Exception { } + @Configuration + static class RootConfig { + + @Bean + public PersonDao personDao() { + return Mockito.mock(PersonDao.class); + } + } + @Configuration @EnableWebMvc static class WebConfig extends WebMvcConfigurerAdapter { + @Autowired + private RootConfig rootConfig; + + @Bean + public PersonController personController() { + return new PersonController(this.rootConfig.personDao()); + } + @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); diff --git a/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/PersonController.java b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/PersonController.java new file mode 100644 index 000000000000..ffeea88e449f --- /dev/null +++ b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/PersonController.java @@ -0,0 +1,42 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * 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.springframework.test.web.servlet.samples.context; + +import org.springframework.stereotype.Controller; +import org.springframework.test.web.Person; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class PersonController { + + private final PersonDao personDao; + + + public PersonController(PersonDao personDao) { + this.personDao = personDao; + } + + @RequestMapping(value="/person/{id}", method=RequestMethod.GET) + @ResponseBody + public Person getPerson(@PathVariable long id) { + return this.personDao.getPerson(id); + } + +} diff --git a/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/PersonDao.java b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/PersonDao.java new file mode 100644 index 000000000000..035b9595d4c4 --- /dev/null +++ b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/PersonDao.java @@ -0,0 +1,25 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * 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.springframework.test.web.servlet.samples.context; + +import org.springframework.test.web.Person; + +public interface PersonDao { + + Person getPerson(Long id); + +} diff --git a/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java index 2fb361f9154e..23cd46d5c34f 100644 --- a/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java +++ b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java @@ -28,6 +28,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.ContextHierarchy; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; @@ -42,7 +43,10 @@ */ @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration("src/test/resources/META-INF/web-resources") -@ContextConfiguration("servlet-context.xml") +@ContextHierarchy({ + @ContextConfiguration("root-context.xml"), + @ContextConfiguration("servlet-context.xml") +}) public class WebAppResourceTests { @Autowired diff --git a/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/XmlConfigTests.java b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/XmlConfigTests.java index 73ab1ab0a95c..e9091ef5b08d 100644 --- a/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/XmlConfigTests.java +++ b/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/samples/context/XmlConfigTests.java @@ -16,20 +16,26 @@ package org.springframework.test.web.servlet.samples.context; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.ContextHierarchy; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.Person; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; +import static org.mockito.Mockito.*; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + /** * Tests with XML configuration. * @@ -38,18 +44,33 @@ */ @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration("src/test/resources/META-INF/web-resources") -@ContextConfiguration("servlet-context.xml") +@ContextHierarchy({ + @ContextConfiguration("root-context.xml"), + @ContextConfiguration("servlet-context.xml") +}) public class XmlConfigTests { @Autowired private WebApplicationContext wac; + @Autowired + private PersonDao personDao; + private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + when(this.personDao.getPerson(5L)).thenReturn(new Person("Joe")); + } + + @Test + public void person() throws Exception { + this.mockMvc.perform(get("/person/5").accept(MediaType.APPLICATION_JSON)) + .andDo(print()) + .andExpect(status().isOk()) + .andExpect(content().string("{\"name\":\"Joe\",\"someDouble\":0.0,\"someBoolean\":false}")); } @Test diff --git a/spring-test-mvc/src/test/resources/org/springframework/test/web/servlet/samples/context/root-context.xml b/spring-test-mvc/src/test/resources/org/springframework/test/web/servlet/samples/context/root-context.xml new file mode 100644 index 000000000000..6456a634caeb --- /dev/null +++ b/spring-test-mvc/src/test/resources/org/springframework/test/web/servlet/samples/context/root-context.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> + + <bean id="personDao" class="org.mockito.Mockito" factory-method="mock"> + <constructor-arg value="org.springframework.test.web.servlet.samples.context.PersonDao" /> + </bean> + +</beans> \ No newline at end of file diff --git a/spring-test-mvc/src/test/resources/org/springframework/test/web/servlet/samples/context/servlet-context.xml b/spring-test-mvc/src/test/resources/org/springframework/test/web/servlet/samples/context/servlet-context.xml index 4e567b1a843d..615534d26d6c 100644 --- a/spring-test-mvc/src/test/resources/org/springframework/test/web/servlet/samples/context/servlet-context.xml +++ b/spring-test-mvc/src/test/resources/org/springframework/test/web/servlet/samples/context/servlet-context.xml @@ -7,6 +7,10 @@ <mvc:annotation-driven /> + <bean class="org.springframework.test.web.servlet.samples.context.PersonController"> + <constructor-arg ref="personDao"/> + </bean> + <mvc:view-controller path="/" view-name="home" /> <mvc:resources mapping="/resources/**" location="/resources/" />
653e9a7cdb8011c1eb3193c034c161db79d14e8a
drools
- throw exception if no user transaction was found--
c
https://github.com/kiegroup/drools
diff --git a/drools-persistence-jpa/src/main/java/org/drools/persistence/jta/JtaTransactionManager.java b/drools-persistence-jpa/src/main/java/org/drools/persistence/jta/JtaTransactionManager.java index 4f9bce3a1c3..8d983f4252d 100644 --- a/drools-persistence-jpa/src/main/java/org/drools/persistence/jta/JtaTransactionManager.java +++ b/drools-persistence-jpa/src/main/java/org/drools/persistence/jta/JtaTransactionManager.java @@ -121,7 +121,7 @@ protected UserTransaction findUserTransaction() { logger.debug( "No UserTransaction found at JNDI location [{}]", DEFAULT_USER_TRANSACTION_NAME, ex ); - return null; + throw new IllegalStateException("Unable to find transaction: " + ex.getMessage(), ex); } }
e102554877356467113bd4e2cbb386a186619206
intellij-community
javadoc--
p
https://github.com/JetBrains/intellij-community
diff --git a/lang-impl/src/com/intellij/util/indexing/FileBasedIndexExtension.java b/lang-impl/src/com/intellij/util/indexing/FileBasedIndexExtension.java index 74617d9e166c8..6fe9f190fa1fc 100644 --- a/lang-impl/src/com/intellij/util/indexing/FileBasedIndexExtension.java +++ b/lang-impl/src/com/intellij/util/indexing/FileBasedIndexExtension.java @@ -25,6 +25,9 @@ public interface FileBasedIndexExtension<K, V> { boolean dependsOnFileContent(); int getVersion(); - + + /** + * @see FileBasedIndexExtension#DEFAULT_CACHE_SIZE + */ int getCacheSize(); }
35cf457bf5c487afb2d380be17956b3084a1e558
ReactiveX-RxJava
Reduce duplication by making "schedule now" the- special case--Forwards to "schedule later" with delay of 0 now.-
p
https://github.com/ReactiveX/RxJava
diff --git a/rxjava-contrib/rxjava-android/src/main/java/rx/concurrency/HandlerThreadScheduler.java b/rxjava-contrib/rxjava-android/src/main/java/rx/concurrency/HandlerThreadScheduler.java index e077999647..bcf2d5066e 100644 --- a/rxjava-contrib/rxjava-android/src/main/java/rx/concurrency/HandlerThreadScheduler.java +++ b/rxjava-contrib/rxjava-android/src/main/java/rx/concurrency/HandlerThreadScheduler.java @@ -12,11 +12,8 @@ import java.util.concurrent.TimeUnit; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; /** @@ -32,40 +29,27 @@ public HandlerThreadScheduler(Handler handler) { @Override public <T> Subscription schedule(final T state, final Func2<Scheduler, T, Subscription> action) { + return schedule(state, action, 0L, TimeUnit.MILLISECONDS); + } + + @Override + public <T> Subscription schedule(final T state, final Func2<Scheduler, T, Subscription> action, long delayTime, TimeUnit unit) { final AtomicObservableSubscription subscription = new AtomicObservableSubscription(); final Scheduler _scheduler = this; - - handler.post(new Runnable() { + handler.postDelayed(new Runnable() { @Override public void run() { subscription.wrap(action.call(_scheduler, state)); } - }); + }, unit.toMillis(delayTime)); return subscription; } - @Override - public <T> Subscription schedule(final T state, final Func2<Scheduler, T, Subscription> action, long delayTime, TimeUnit unit) { - if (delayTime == 0) { - return schedule(state, action); - } else { - final AtomicObservableSubscription subscription = new AtomicObservableSubscription(); - final Scheduler _scheduler = this; - handler.postDelayed(new Runnable() { - @Override - public void run() { - subscription.wrap(action.call(_scheduler, state)); - } - }, unit.toMillis(delayTime)); - return subscription; - } - } - @RunWith(AndroidTestRunner.class) public static final class UnitTest { @Test - public void shouldScheduleActionOnHandlerThread() { + public void shouldScheduleImmediateActionOnHandlerThread() { final Handler handler = mock(Handler.class); final Object state = new Object(); final Func2<Scheduler, Object, Subscription> action = mock(Func2.class); @@ -75,7 +59,7 @@ public void shouldScheduleActionOnHandlerThread() { // verify that we post to the given Handler ArgumentCaptor<Runnable> runnable = ArgumentCaptor.forClass(Runnable.class); - verify(handler).post(runnable.capture()); + verify(handler).postDelayed(runnable.capture(), eq(0L)); // verify that the given handler delegates to our action runnable.getValue().run(); @@ -99,21 +83,6 @@ public void shouldScheduleDelayedActionOnHandlerThread() { runnable.getValue().run(); verify(action).call(scheduler, state); } - - @Test - public void scheduleDelayedActionShouldForwardToNormalPostIfDelayIsZero() { - final Handler handler = mock(Handler.class); - final Object state = new Object(); - final Func2<Scheduler, Object, Subscription> action = mock(Func2.class); - - Scheduler scheduler = new HandlerThreadScheduler(handler); - scheduler.schedule(state, action, 0L, TimeUnit.SECONDS); - - // verify that we post to the given Handler - verify(handler).post(any(Runnable.class)); - verify(handler, never()).postDelayed(any(Runnable.class), anyLong()); - } - } }
ac03fba9d31c9cca163739df3c05bc1984d230dc
elasticsearch
Small cleanup--
p
https://github.com/elastic/elasticsearch
diff --git a/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java b/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java index fb4468b4784ad..6a15044657a73 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java @@ -155,9 +155,9 @@ public static class Builder { private Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS; - private ImmutableOpenMap.Builder<String, CompressedString> mappings; + private final ImmutableOpenMap.Builder<String, CompressedString> mappings; - private ImmutableOpenMap.Builder<String, IndexMetaData.Custom> customs; + private final ImmutableOpenMap.Builder<String, IndexMetaData.Custom> customs; public Builder(String name) { this.name = name; @@ -166,7 +166,7 @@ public Builder(String name) { } public Builder(IndexTemplateMetaData indexTemplateMetaData) { - this(indexTemplateMetaData.name()); + this.name = indexTemplateMetaData.name(); order(indexTemplateMetaData.order()); template(indexTemplateMetaData.template()); settings(indexTemplateMetaData.settings()); diff --git a/src/main/java/org/elasticsearch/gateway/local/state/meta/LocalGatewayMetaState.java b/src/main/java/org/elasticsearch/gateway/local/state/meta/LocalGatewayMetaState.java index e6f14b0acbbe4..4b6fcedb5c091 100644 --- a/src/main/java/org/elasticsearch/gateway/local/state/meta/LocalGatewayMetaState.java +++ b/src/main/java/org/elasticsearch/gateway/local/state/meta/LocalGatewayMetaState.java @@ -230,7 +230,6 @@ public void clusterChanged(ClusterChangedEvent event) { continue; } if (!newMetaData.hasIndex(current.index())) { - // TODO: Create util for toString() logger.debug("[{}] deleting index that is no longer part of the metadata (indices: [{}])", current.index(), newMetaData.indices().keys()); if (nodeEnv.hasNodeFile()) { FileSystemUtils.deleteRecursively(nodeEnv.indexLocations(new Index(current.index()))); diff --git a/src/main/java/org/elasticsearch/gateway/none/NoneGateway.java b/src/main/java/org/elasticsearch/gateway/none/NoneGateway.java index 6c77ec38d4cbb..0e1fceae4a186 100644 --- a/src/main/java/org/elasticsearch/gateway/none/NoneGateway.java +++ b/src/main/java/org/elasticsearch/gateway/none/NoneGateway.java @@ -116,7 +116,6 @@ public void clusterChanged(ClusterChangedEvent event) { // only delete indices when we already received a state (currentMetaData != null) for (IndexMetaData current : currentMetaData) { if (!newMetaData.hasIndex(current.index())) { - // TODO: have util for toString() logger.debug("[{}] deleting index that is no longer part of the metadata (indices: [{}])", current.index(), newMetaData.indices().keys()); if (nodeEnv.hasNodeFile()) { FileSystemUtils.deleteRecursively(nodeEnv.indexLocations(new Index(current.index())));
0d8d64ea057546e5e2dcd312fe5a80fcb3214460
intellij-community
cleanup (IDEA-90461)--
c
https://github.com/JetBrains/intellij-community
diff --git a/platform/util/src/com/intellij/util/io/ZipUtil.java b/platform/util/src/com/intellij/util/io/ZipUtil.java index bfa564a6298bb..21ace593552b6 100644 --- a/platform/util/src/com/intellij/util/io/ZipUtil.java +++ b/platform/util/src/com/intellij/util/io/ZipUtil.java @@ -179,34 +179,44 @@ public static void extractEntry(ZipEntry entry, final InputStream inputStream, F public static boolean isZipContainsFolder(File zip) throws IOException { ZipFile zipFile = new ZipFile(zip); - Enumeration en = zipFile.entries(); - - while (en.hasMoreElements()) { - ZipEntry zipEntry = (ZipEntry)en.nextElement(); + try { + Enumeration en = zipFile.entries(); - // we do not necessarily get a separate entry for the subdirectory when the file - // in the ZIP archive is placed in a subdirectory, so we need to check if the slash - // is found anywhere in the path - if (zipEntry.getName().indexOf('/') >= 0) { - return true; + while (en.hasMoreElements()) { + ZipEntry zipEntry = (ZipEntry)en.nextElement(); + + // we do not necessarily get a separate entry for the subdirectory when the file + // in the ZIP archive is placed in a subdirectory, so we need to check if the slash + // is found anywhere in the path + if (zipEntry.getName().indexOf('/') >= 0) { + return true; + } } + zipFile.close(); + return false; + } + finally { + zipFile.close(); } - zipFile.close(); - return false; } public static boolean isZipContainsEntry(File zip, String relativePath) throws IOException { ZipFile zipFile = new ZipFile(zip); - Enumeration en = zipFile.entries(); + try { + Enumeration en = zipFile.entries(); - while (en.hasMoreElements()) { - ZipEntry zipEntry = (ZipEntry)en.nextElement(); - if (relativePath.equals(zipEntry.getName())) { - return true; + while (en.hasMoreElements()) { + ZipEntry zipEntry = (ZipEntry)en.nextElement(); + if (relativePath.equals(zipEntry.getName())) { + return true; + } } + zipFile.close(); + return false; + } + finally { + zipFile.close(); } - zipFile.close(); - return false; } /*
0950c46beda335819928585f1262dfe1dca78a0b
ReactiveX-RxJava
Trying to extend the Scheduler interface according- to the comments at -19.--
a
https://github.com/ReactiveX/RxJava
diff --git a/rxjava-core/src/main/java/rx/Scheduler.java b/rxjava-core/src/main/java/rx/Scheduler.java index 74fe274b3a..e1e7c1e806 100644 --- a/rxjava-core/src/main/java/rx/Scheduler.java +++ b/rxjava-core/src/main/java/rx/Scheduler.java @@ -19,12 +19,31 @@ import rx.util.functions.Action0; import rx.util.functions.Func0; +import rx.util.functions.Func1; +import rx.util.functions.Func2; /** * Represents an object that schedules units of work. */ public interface Scheduler { + /** + * Schedules a cancelable action to be executed. + * + * @param state State to pass into the action. + * @param action Action to schedule. + * @return a subscription to be able to unsubscribe from action. + */ + <T> Subscription schedule(T state, Func2<Scheduler, T, Subscription> action); + + /** + * Schedules a cancelable action to be executed. + * + * @param action Action to schedule. + * @return a subscription to be able to unsubscribe from action. + */ + Subscription schedule(Func1<Scheduler, Subscription> action); + /** * Schedules a cancelable action to be executed. * @@ -43,6 +62,27 @@ public interface Scheduler { */ Subscription schedule(Action0 action); + /** + * Schedules a cancelable action to be executed in dueTime. + * + * @param state State to pass into the action. + * @param action Action to schedule. + * @param dueTime Time the action is due for executing. + * @param unit Time unit of the due time. + * @return a subscription to be able to unsubscribe from action. + */ + <T> Subscription schedule(T state, Func2<Scheduler, T, Subscription> action, long dueTime, TimeUnit unit); + + /** + * Schedules a cancelable action to be executed in dueTime. + * + * @param action Action to schedule. + * @param dueTime Time the action is due for executing. + * @param unit Time unit of the due time. + * @return a subscription to be able to unsubscribe from action. + */ + Subscription schedule(Func1<Scheduler, Subscription> action, long dueTime, TimeUnit unit); + /** * Schedules an action to be executed in dueTime. * diff --git a/rxjava-core/src/main/java/rx/concurrency/AbstractScheduler.java b/rxjava-core/src/main/java/rx/concurrency/AbstractScheduler.java index e6fc87ebdb..d15e8e184a 100644 --- a/rxjava-core/src/main/java/rx/concurrency/AbstractScheduler.java +++ b/rxjava-core/src/main/java/rx/concurrency/AbstractScheduler.java @@ -22,6 +22,8 @@ import rx.subscriptions.Subscriptions; import rx.util.functions.Action0; import rx.util.functions.Func0; +import rx.util.functions.Func1; +import rx.util.functions.Func2; /* package */abstract class AbstractScheduler implements Scheduler { @@ -30,11 +32,51 @@ public Subscription schedule(Action0 action) { return schedule(asFunc0(action)); } + @Override + public Subscription schedule(final Func1<Scheduler, Subscription> action) { + return schedule(new Func0<Subscription>() { + @Override + public Subscription call() { + return action.call(AbstractScheduler.this); + } + }); + } + + @Override + public <T> Subscription schedule(final T state, final Func2<Scheduler, T, Subscription> action) { + return schedule(new Func0<Subscription>() { + @Override + public Subscription call() { + return action.call(AbstractScheduler.this, state); + } + }); + } + @Override public Subscription schedule(Action0 action, long dueTime, TimeUnit unit) { return schedule(asFunc0(action), dueTime, unit); } + @Override + public Subscription schedule(final Func1<Scheduler, Subscription> action, long dueTime, TimeUnit unit) { + return schedule(new Func0<Subscription>() { + @Override + public Subscription call() { + return action.call(AbstractScheduler.this); + } + }, dueTime, unit); + } + + @Override + public <T> Subscription schedule(final T state, final Func2<Scheduler, T, Subscription> action, long dueTime, TimeUnit unit) { + return schedule(new Func0<Subscription>() { + @Override + public Subscription call() { + return action.call(AbstractScheduler.this, state); + } + }, dueTime, unit); + } + @Override public long now() { return System.nanoTime(); diff --git a/rxjava-core/src/main/java/rx/operators/Tester.java b/rxjava-core/src/main/java/rx/operators/Tester.java index bc04242846..11b2c8a798 100644 --- a/rxjava-core/src/main/java/rx/operators/Tester.java +++ b/rxjava-core/src/main/java/rx/operators/Tester.java @@ -19,6 +19,7 @@ import rx.util.functions.Action0; import rx.util.functions.Func0; import rx.util.functions.Func1; +import rx.util.functions.Func2; /** * Common utility functions for testing operator implementations. @@ -289,6 +290,16 @@ public Subscription schedule(Func0<Subscription> action) { return underlying.schedule(action); } + @Override + public Subscription schedule(Func1<Scheduler, Subscription> action) { + return underlying.schedule(action); + } + + @Override + public <T> Subscription schedule(T state, Func2<Scheduler, T, Subscription> action) { + return underlying.schedule(state, action); + } + @Override public Subscription schedule(Action0 action, long dueTime, TimeUnit unit) { return underlying.schedule(action, dueTime, unit); @@ -299,6 +310,16 @@ public Subscription schedule(Func0<Subscription> action, long dueTime, TimeUnit return underlying.schedule(action, dueTime, unit); } + @Override + public Subscription schedule(Func1<Scheduler, Subscription> action, long dueTime, TimeUnit unit) { + return underlying.schedule(action, dueTime, unit); + } + + @Override + public <T> Subscription schedule(T state, Func2<Scheduler, T, Subscription> action, long dueTime, TimeUnit unit) { + return underlying.schedule(state, action, dueTime, unit); + } + @Override public long now() { return underlying.now();
28696f9d6030a11da29b47c760026b7568002df8
kotlin
Try keyword--
a
https://github.com/JetBrains/kotlin
diff --git a/idea/src/org/jetbrains/jet/lexer/_JetLexer.java b/idea/src/org/jetbrains/jet/lexer/_JetLexer.java index c905dc614d55c..928cafa6a5194 100644 --- a/idea/src/org/jetbrains/jet/lexer/_JetLexer.java +++ b/idea/src/org/jetbrains/jet/lexer/_JetLexer.java @@ -1,4 +1,4 @@ -/* The following code was generated by JFlex 1.4.3 on 12/27/10 6:49 PM */ +/* The following code was generated by JFlex 1.4.3 on 12/27/10 7:06 PM */ /* It's an automatically generated code. Do not modify it. */ package org.jetbrains.jet.lexer; @@ -13,7 +13,7 @@ /** * This class is a scanner generated by * <a href="http://www.jflex.de/">JFlex</a> 1.4.3 - * on 12/27/10 6:49 PM from the specification file + * on 12/27/10 7:06 PM from the specification file * <tt>/home/user/work/jet/idea/src/org/jetbrains/jet/lexer/Jet.flex</tt> */ class _JetLexer implements FlexLexer { @@ -148,17 +148,17 @@ class _JetLexer implements FlexLexer { "\10\3\1\47\1\50\1\51\6\3\1\52\4\3\1\53"+ "\1\54\1\55\1\56\1\57\1\60\1\61\1\62\1\63"+ "\1\64\1\65\1\66\1\34\1\36\1\67\1\0\1\33"+ - "\3\0\1\12\1\70\1\3\1\71\13\3\1\72\1\73"+ - "\1\3\1\74\1\3\1\75\1\76\1\3\1\77\3\3"+ - "\1\100\1\0\2\67\1\0\1\34\2\0\1\3\1\101"+ - "\1\3\1\102\3\3\1\103\1\104\1\3\1\105\7\3"+ - "\1\36\1\0\1\34\1\0\1\3\1\106\1\3\1\107"+ - "\2\3\1\110\1\111\1\3\1\112\2\3\1\113\1\114"+ - "\1\70\3\3\1\115\1\116\1\3\1\117\6\3\1\120"+ - "\1\3\1\121\1\122\1\3\1\123"; + "\3\0\1\12\1\70\1\3\1\71\11\3\1\72\2\3"+ + "\1\73\1\74\1\3\1\75\1\3\1\76\1\77\1\3"+ + "\1\100\3\3\1\101\1\0\2\67\1\0\1\34\2\0"+ + "\1\3\1\102\1\3\1\103\3\3\1\104\1\105\1\3"+ + "\1\106\7\3\1\36\1\0\1\34\1\0\1\3\1\107"+ + "\1\3\1\110\2\3\1\111\1\112\1\3\1\113\2\3"+ + "\1\114\1\115\1\70\3\3\1\116\1\117\1\3\1\120"+ + "\6\3\1\121\1\3\1\122\1\123\1\3\1\124"; private static int [] zzUnpackAction() { - int [] result = new int[203]; + int [] result = new int[204]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -198,20 +198,20 @@ private static int zzUnpackAction(String packed, int offset, int [] result) { "\0\76\0\76\0\u10b6\0\76\0\76\0\76\0\76\0\76"+ "\0\u10f4\0\u1132\0\u1170\0\u11ae\0\u11ae\0\u11ec\0\u122a\0\u1268"+ "\0\76\0\u12a6\0\u12e4\0\272\0\u1322\0\u1360\0\u139e\0\u13dc"+ - "\0\u141a\0\u1458\0\u1496\0\u14d4\0\u1512\0\u1550\0\u158e\0\272"+ - "\0\272\0\u15cc\0\272\0\u160a\0\272\0\272\0\u1648\0\272"+ - "\0\u1686\0\u16c4\0\u1702\0\76\0\u1740\0\u177e\0\76\0\u17bc"+ - "\0\u17fa\0\u1838\0\u1876\0\u18b4\0\272\0\u18f2\0\272\0\u1930"+ - "\0\u196e\0\u19ac\0\u19ea\0\272\0\u1a28\0\272\0\u1a66\0\u1aa4"+ - "\0\u1ae2\0\u1b20\0\u1b5e\0\u1b9c\0\u1bda\0\76\0\u1c18\0\u11ae"+ - "\0\u1c56\0\u1c94\0\272\0\u1cd2\0\272\0\u1d10\0\u1d4e\0\272"+ - "\0\272\0\u1d8c\0\272\0\u1dca\0\u1e08\0\272\0\272\0\76"+ - "\0\u1e46\0\u1e84\0\u1ec2\0\272\0\272\0\u1f00\0\272\0\u1f3e"+ - "\0\u1f7c\0\u1fba\0\u1ff8\0\u2036\0\u2074\0\272\0\u20b2\0\272"+ - "\0\272\0\u20f0\0\272"; + "\0\u141a\0\u1458\0\u1496\0\u14d4\0\u1512\0\272\0\u1550\0\u158e"+ + "\0\272\0\272\0\u15cc\0\272\0\u160a\0\272\0\272\0\u1648"+ + "\0\272\0\u1686\0\u16c4\0\u1702\0\76\0\u1740\0\u177e\0\76"+ + "\0\u17bc\0\u17fa\0\u1838\0\u1876\0\u18b4\0\272\0\u18f2\0\272"+ + "\0\u1930\0\u196e\0\u19ac\0\u19ea\0\272\0\u1a28\0\272\0\u1a66"+ + "\0\u1aa4\0\u1ae2\0\u1b20\0\u1b5e\0\u1b9c\0\u1bda\0\76\0\u1c18"+ + "\0\u11ae\0\u1c56\0\u1c94\0\272\0\u1cd2\0\272\0\u1d10\0\u1d4e"+ + "\0\272\0\272\0\u1d8c\0\272\0\u1dca\0\u1e08\0\272\0\272"+ + "\0\76\0\u1e46\0\u1e84\0\u1ec2\0\272\0\272\0\u1f00\0\272"+ + "\0\u1f3e\0\u1f7c\0\u1fba\0\u1ff8\0\u2036\0\u2074\0\272\0\u20b2"+ + "\0\272\0\272\0\u20f0\0\272"; private static int [] zzUnpackRowMap() { - int [] result = new int[203]; + int [] result = new int[204]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -315,136 +315,136 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) { "\5\4\1\173\21\4\23\0\2\4\1\0\2\4\3\0"+ "\5\4\1\0\1\4\1\0\1\4\3\0\13\4\1\174"+ "\1\4\1\175\11\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\17\4\1\176"+ - "\7\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\1\177\26\4\23\0\2\4"+ - "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\11\4\1\200\3\4\1\201\11\4\23\0\2\4"+ - "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\7\4\1\202\6\4\1\203\10\4\23\0\2\4"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\10\4\1\176"+ + "\6\4\1\177\7\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\1\200\26\4"+ + "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ + "\1\0\1\4\3\0\11\4\1\201\3\4\1\202\11\4"+ + "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ + "\1\0\1\4\3\0\7\4\1\203\6\4\1\204\10\4"+ + "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ + "\1\0\1\4\3\0\11\4\1\205\15\4\23\0\2\4"+ "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\11\4\1\204\15\4\23\0\2\4\1\0\2\4"+ - "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\1\205"+ - "\26\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\15\4\1\206\11\4\23\0"+ + "\3\0\1\206\26\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\15\4\1\207"+ + "\11\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ + "\1\4\1\0\1\4\3\0\6\4\1\210\20\4\23\0"+ "\2\4\1\0\2\4\3\0\5\4\1\0\1\4\1\0"+ - "\1\4\3\0\6\4\1\207\20\4\23\0\2\4\1\0"+ + "\1\4\3\0\7\4\1\211\17\4\23\0\2\4\1\0"+ "\2\4\3\0\5\4\1\0\1\4\1\0\1\4\3\0"+ - "\7\4\1\210\17\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\26\4\1\211"+ - "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ - "\1\0\1\4\3\0\13\4\1\212\13\4\23\0\2\4"+ - "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\3\4\1\213\23\4\111\0\1\214\7\0\1\151"+ - "\7\0\1\151\3\0\1\56\25\0\1\56\1\0\1\56"+ - "\30\0\7\152\1\215\66\152\6\216\1\217\1\153\66\216"+ - "\1\0\2\154\6\0\1\154\1\0\1\154\1\0\1\154"+ - "\1\0\1\154\1\0\1\220\4\0\1\154\1\0\1\154"+ - "\1\0\1\220\1\154\7\0\1\154\1\0\1\154\3\0"+ - "\1\154\25\0\2\154\6\0\1\154\1\0\1\154\1\0"+ - "\1\154\1\150\1\154\1\0\1\220\4\0\1\154\1\0"+ - "\1\154\1\0\1\220\1\154\7\0\1\154\1\0\1\154"+ - "\3\0\1\154\25\0\1\221\1\154\6\0\1\221\1\0"+ - "\1\154\1\0\1\154\1\0\1\154\1\222\1\220\4\0"+ - "\1\154\1\0\1\154\1\0\1\220\1\154\7\0\1\154"+ - "\1\0\1\154\3\0\1\154\10\0\1\222\31\0\1\150"+ - "\57\0\24\162\1\223\51\162\1\0\2\4\1\0\2\4"+ - "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\3\4"+ - "\1\224\23\4\23\0\2\4\1\0\2\4\3\0\5\4"+ - "\1\0\1\4\1\0\1\4\3\0\11\4\1\225\15\4"+ + "\26\4\1\212\23\0\2\4\1\0\2\4\3\0\5\4"+ + "\1\0\1\4\1\0\1\4\3\0\13\4\1\213\13\4"+ "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ - "\1\0\1\4\3\0\6\4\1\226\20\4\23\0\2\4"+ + "\1\0\1\4\3\0\3\4\1\214\23\4\111\0\1\215"+ + "\7\0\1\151\7\0\1\151\3\0\1\56\25\0\1\56"+ + "\1\0\1\56\30\0\7\152\1\216\66\152\6\217\1\220"+ + "\1\153\66\217\1\0\2\154\6\0\1\154\1\0\1\154"+ + "\1\0\1\154\1\0\1\154\1\0\1\221\4\0\1\154"+ + "\1\0\1\154\1\0\1\221\1\154\7\0\1\154\1\0"+ + "\1\154\3\0\1\154\25\0\2\154\6\0\1\154\1\0"+ + "\1\154\1\0\1\154\1\150\1\154\1\0\1\221\4\0"+ + "\1\154\1\0\1\154\1\0\1\221\1\154\7\0\1\154"+ + "\1\0\1\154\3\0\1\154\25\0\1\222\1\154\6\0"+ + "\1\222\1\0\1\154\1\0\1\154\1\0\1\154\1\223"+ + "\1\221\4\0\1\154\1\0\1\154\1\0\1\221\1\154"+ + "\7\0\1\154\1\0\1\154\3\0\1\154\10\0\1\223"+ + "\31\0\1\150\57\0\24\162\1\224\51\162\1\0\2\4"+ "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\3\4\1\227\23\4\23\0\2\4\1\0\2\4"+ - "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\3\4"+ - "\1\230\23\4\23\0\2\4\1\0\2\4\3\0\5\4"+ - "\1\0\1\4\1\0\1\4\3\0\4\4\1\231\22\4"+ + "\3\0\3\4\1\225\23\4\23\0\2\4\1\0\2\4"+ + "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\11\4"+ + "\1\226\15\4\23\0\2\4\1\0\2\4\3\0\5\4"+ + "\1\0\1\4\1\0\1\4\3\0\6\4\1\227\20\4"+ "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ - "\1\0\1\4\3\0\7\4\1\232\17\4\23\0\2\4"+ + "\1\0\1\4\3\0\3\4\1\230\23\4\23\0\2\4"+ "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\3\4\1\233\23\4\23\0\2\4\1\0\2\4"+ + "\3\0\3\4\1\231\23\4\23\0\2\4\1\0\2\4"+ "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\4\4"+ - "\1\234\22\4\23\0\2\4\1\0\2\4\3\0\5\4"+ - "\1\0\1\4\1\0\1\4\3\0\21\4\1\235\5\4"+ + "\1\232\22\4\23\0\2\4\1\0\2\4\3\0\5\4"+ + "\1\0\1\4\1\0\1\4\3\0\7\4\1\233\17\4"+ "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ - "\1\0\1\4\3\0\3\4\1\236\23\4\23\0\2\4"+ + "\1\0\1\4\3\0\3\4\1\234\23\4\23\0\2\4"+ "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\21\4\1\237\5\4\23\0\2\4\1\0\2\4"+ - "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\17\4"+ - "\1\240\7\4\23\0\2\4\1\0\2\4\3\0\5\4"+ - "\1\0\1\4\1\0\1\4\3\0\4\4\1\241\22\4"+ + "\3\0\4\4\1\235\22\4\23\0\2\4\1\0\2\4"+ + "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\21\4"+ + "\1\236\5\4\23\0\2\4\1\0\2\4\3\0\5\4"+ + "\1\0\1\4\1\0\1\4\3\0\3\4\1\237\23\4"+ "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ - "\1\0\1\4\3\0\21\4\1\242\5\4\23\0\2\4"+ + "\1\0\1\4\3\0\21\4\1\240\5\4\23\0\2\4"+ "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\3\4\1\243\23\4\23\0\2\4\1\0\2\4"+ - "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\11\4"+ - "\1\244\15\4\23\0\2\4\1\0\2\4\3\0\5\4"+ - "\1\0\1\4\1\0\1\4\3\0\1\4\1\245\25\4"+ - "\22\0\6\152\1\246\1\215\66\152\7\216\1\247\66\216"+ - "\1\0\1\151\7\0\1\151\6\0\1\222\41\0\1\222"+ - "\14\0\1\221\1\154\6\0\1\221\1\0\1\154\1\0"+ - "\1\250\1\0\1\154\1\0\1\220\4\0\1\154\1\0"+ - "\1\154\1\0\1\220\1\154\7\0\1\250\1\0\1\250"+ - "\3\0\1\154\25\0\1\151\7\0\1\151\64\0\24\162"+ - "\1\251\51\162\1\0\2\4\1\0\2\4\3\0\5\4"+ - "\1\0\1\4\1\0\1\4\3\0\4\4\1\252\22\4"+ + "\3\0\17\4\1\241\7\4\23\0\2\4\1\0\2\4"+ + "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\4\4"+ + "\1\242\22\4\23\0\2\4\1\0\2\4\3\0\5\4"+ + "\1\0\1\4\1\0\1\4\3\0\21\4\1\243\5\4"+ "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ - "\1\0\1\4\3\0\12\4\1\253\14\4\23\0\2\4"+ + "\1\0\1\4\3\0\3\4\1\244\23\4\23\0\2\4"+ "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\1\254\26\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\4\4\1\255"+ - "\22\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\13\4\1\256\13\4\23\0"+ + "\3\0\11\4\1\245\15\4\23\0\2\4\1\0\2\4"+ + "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\1\4"+ + "\1\246\25\4\22\0\6\152\1\247\1\216\66\152\7\217"+ + "\1\250\66\217\1\0\1\151\7\0\1\151\6\0\1\223"+ + "\41\0\1\223\14\0\1\222\1\154\6\0\1\222\1\0"+ + "\1\154\1\0\1\251\1\0\1\154\1\0\1\221\4\0"+ + "\1\154\1\0\1\154\1\0\1\221\1\154\7\0\1\251"+ + "\1\0\1\251\3\0\1\154\25\0\1\151\7\0\1\151"+ + "\64\0\24\162\1\252\51\162\1\0\2\4\1\0\2\4"+ + "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\4\4"+ + "\1\253\22\4\23\0\2\4\1\0\2\4\3\0\5\4"+ + "\1\0\1\4\1\0\1\4\3\0\12\4\1\254\14\4"+ + "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ + "\1\0\1\4\3\0\1\255\26\4\23\0\2\4\1\0"+ + "\2\4\3\0\5\4\1\0\1\4\1\0\1\4\3\0"+ + "\4\4\1\256\22\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\13\4\1\257"+ + "\13\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ + "\1\4\1\0\1\4\3\0\21\4\1\260\5\4\23\0"+ "\2\4\1\0\2\4\3\0\5\4\1\0\1\4\1\0"+ - "\1\4\3\0\21\4\1\257\5\4\23\0\2\4\1\0"+ + "\1\4\3\0\23\4\1\261\3\4\23\0\2\4\1\0"+ "\2\4\3\0\5\4\1\0\1\4\1\0\1\4\3\0"+ - "\23\4\1\260\3\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\7\4\1\261"+ - "\17\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\15\4\1\262\11\4\23\0"+ + "\7\4\1\262\17\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\15\4\1\263"+ + "\11\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ + "\1\4\1\0\1\4\3\0\3\4\1\264\23\4\23\0"+ "\2\4\1\0\2\4\3\0\5\4\1\0\1\4\1\0"+ - "\1\4\3\0\3\4\1\263\23\4\23\0\2\4\1\0"+ + "\1\4\3\0\2\4\1\265\24\4\23\0\2\4\1\0"+ "\2\4\3\0\5\4\1\0\1\4\1\0\1\4\3\0"+ - "\2\4\1\264\24\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\6\4\1\265"+ - "\20\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\3\4\1\266\23\4\23\0"+ + "\6\4\1\266\20\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\3\4\1\267"+ + "\23\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ + "\1\4\1\0\1\4\3\0\25\4\1\270\1\4\22\0"+ + "\6\217\1\220\1\250\66\217\24\162\1\271\51\162\1\0"+ "\2\4\1\0\2\4\3\0\5\4\1\0\1\4\1\0"+ - "\1\4\3\0\25\4\1\267\1\4\22\0\6\216\1\217"+ - "\1\247\66\216\24\162\1\270\51\162\1\0\2\4\1\0"+ + "\1\4\3\0\5\4\1\272\21\4\23\0\2\4\1\0"+ "\2\4\3\0\5\4\1\0\1\4\1\0\1\4\3\0"+ - "\5\4\1\271\21\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\4\4\1\272"+ - "\22\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\1\273\26\4\23\0\2\4"+ + "\4\4\1\273\22\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\1\274\26\4"+ + "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ + "\1\0\1\4\3\0\16\4\1\275\10\4\23\0\2\4"+ "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\16\4\1\274\10\4\23\0\2\4\1\0\2\4"+ - "\3\0\5\4\1\0\1\4\1\0\1\4\3\0\1\275"+ - "\26\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\5\4\1\276\21\4\23\0"+ + "\3\0\1\276\26\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\5\4\1\277"+ + "\21\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ + "\1\4\1\0\1\4\3\0\7\4\1\300\17\4\23\0"+ "\2\4\1\0\2\4\3\0\5\4\1\0\1\4\1\0"+ - "\1\4\3\0\7\4\1\277\17\4\23\0\2\4\1\0"+ + "\1\4\3\0\1\4\1\301\25\4\23\0\2\4\1\0"+ "\2\4\3\0\5\4\1\0\1\4\1\0\1\4\3\0"+ - "\1\4\1\300\25\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\13\4\1\301"+ - "\13\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\17\4\1\302\7\4\23\0"+ + "\13\4\1\302\13\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\17\4\1\303"+ + "\7\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ + "\1\4\1\0\1\4\3\0\21\4\1\304\5\4\23\0"+ "\2\4\1\0\2\4\3\0\5\4\1\0\1\4\1\0"+ - "\1\4\3\0\21\4\1\303\5\4\23\0\2\4\1\0"+ + "\1\4\3\0\6\4\1\305\20\4\23\0\2\4\1\0"+ "\2\4\3\0\5\4\1\0\1\4\1\0\1\4\3\0"+ - "\6\4\1\304\20\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\21\4\1\305"+ - "\5\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ - "\1\4\1\0\1\4\3\0\3\4\1\306\23\4\23\0"+ + "\21\4\1\306\5\4\23\0\2\4\1\0\2\4\3\0"+ + "\5\4\1\0\1\4\1\0\1\4\3\0\3\4\1\307"+ + "\23\4\23\0\2\4\1\0\2\4\3\0\5\4\1\0"+ + "\1\4\1\0\1\4\3\0\4\4\1\310\22\4\23\0"+ "\2\4\1\0\2\4\3\0\5\4\1\0\1\4\1\0"+ - "\1\4\3\0\4\4\1\307\22\4\23\0\2\4\1\0"+ + "\1\4\3\0\3\4\1\311\23\4\23\0\2\4\1\0"+ "\2\4\3\0\5\4\1\0\1\4\1\0\1\4\3\0"+ - "\3\4\1\310\23\4\23\0\2\4\1\0\2\4\3\0"+ - "\5\4\1\0\1\4\1\0\1\4\3\0\1\311\26\4"+ + "\1\312\26\4\23\0\2\4\1\0\2\4\3\0\5\4"+ + "\1\0\1\4\1\0\1\4\3\0\3\4\1\313\23\4"+ "\23\0\2\4\1\0\2\4\3\0\5\4\1\0\1\4"+ - "\1\0\1\4\3\0\3\4\1\312\23\4\23\0\2\4"+ - "\1\0\2\4\3\0\5\4\1\0\1\4\1\0\1\4"+ - "\3\0\15\4\1\313\11\4\22\0"; + "\1\0\1\4\3\0\15\4\1\314\11\4\22\0"; private static int [] zzUnpackTrans() { int [] result = new int[8494]; @@ -490,12 +490,12 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) { private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\0\1\11\30\1\6\11\11\1\5\11\4\1\2\11"+ "\1\0\3\1\6\11\36\1\6\11\1\1\5\11\3\1"+ - "\1\0\1\1\3\0\1\11\32\1\1\11\1\0\1\1"+ + "\1\0\1\1\3\0\1\11\33\1\1\11\1\0\1\1"+ "\1\11\1\0\1\1\2\0\22\1\1\11\1\0\1\1"+ "\1\0\16\1\1\11\23\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[203]; + int [] result = new int[204]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -803,335 +803,339 @@ else if (zzAtEOF) { case 3: { return JetTokens.IDENTIFIER; } - case 84: break; - case 62: - { return JetTokens.FOR_KEYWORD ; - } case 85: break; case 63: - { return JetTokens.OUT_KEYWORD ; + { return JetTokens.FOR_KEYWORD ; } case 86: break; - case 78: - { return JetTokens.RETURN_KEYWORD ; + case 64: + { return JetTokens.OUT_KEYWORD ; } case 87: break; - case 65: - { return JetTokens.NULL_KEYWORD ; + case 79: + { return JetTokens.RETURN_KEYWORD ; } case 88: break; + case 66: + { return JetTokens.NULL_KEYWORD ; + } + case 89: break; case 20: { return JetTokens.LT ; } - case 89: break; + case 90: break; case 42: { return JetTokens.DO_KEYWORD ; } - case 90: break; + case 91: break; case 17: { return JetTokens.PLUS ; } - case 91: break; + case 92: break; case 27: { return JetTokens.LONG_LITERAL; } - case 92: break; + case 93: break; case 56: { return JetTokens.RAW_STRING_LITERAL; } - case 93: break; + case 94: break; case 44: { return JetTokens.PLUSEQ ; } - case 94: break; + case 95: break; case 26: { return JetTokens.COMMA ; } - case 95: break; - case 70: + case 96: break; + case 71: { return JetTokens.MATCH_KEYWORD ; } - case 96: break; + case 97: break; case 21: { return JetTokens.GT ; } - case 97: break; + case 98: break; case 4: { return JetTokens.WHITE_SPACE; } - case 98: break; - case 77: + case 99: break; + case 78: { return JetTokens.TYPEOF_KEYWORD ; } - case 99: break; + case 100: break; case 16: { return JetTokens.RPAR ; } - case 100: break; - case 69: + case 101: break; + case 70: { return JetTokens.TRUE_KEYWORD ; } - case 101: break; + case 102: break; case 50: { return JetTokens.ANDAND ; } - case 102: break; + case 103: break; case 55: { return JetTokens.DOC_COMMENT; } - case 103: break; + case 104: break; case 28: { return JetTokens.FLOAT_LITERAL; } - case 104: break; + case 105: break; case 29: { return JetTokens.EOL_COMMENT; } - case 105: break; + case 106: break; case 24: { return JetTokens.COLON ; } - case 106: break; + case 107: break; case 47: { return JetTokens.LTEQ ; } - case 107: break; + case 108: break; case 11: { return JetTokens.LBRACKET ; } - case 108: break; + case 109: break; case 54: { yypushback(2); return JetTokens.INTEGER_LITERAL; } - case 109: break; + case 110: break; case 9: { return JetTokens.CHARACTER_LITERAL; } - case 110: break; - case 59: + case 111: break; + case 60: { return JetTokens.VAR_KEYWORD ; } - case 111: break; + case 112: break; case 48: { return JetTokens.GTEQ ; } - case 112: break; + case 113: break; case 2: { return JetTokens.INTEGER_LITERAL; } - case 113: break; + case 114: break; case 14: { return JetTokens.RBRACE ; } - case 114: break; - case 71: + case 115: break; + case 72: { return JetTokens.CLASS_KEYWORD ; } - case 115: break; + case 116: break; case 18: { return JetTokens.EXCL ; } - case 116: break; + case 117: break; + case 58: + { return JetTokens.TRY_KEYWORD ; + } + case 118: break; case 45: { return JetTokens.EXCLEQ ; } - case 117: break; + case 119: break; case 37: { return JetTokens.MINUSEQ ; } - case 118: break; - case 72: + case 120: break; + case 73: { return JetTokens.THROW_KEYWORD ; } - case 119: break; - case 75: + case 121: break; + case 76: { return JetTokens.WHILE_KEYWORD ; } - case 120: break; + case 122: break; case 36: { return JetTokens.MINUSMINUS; } - case 121: break; - case 80: + case 123: break; + case 81: { return JetTokens.CONTINUE_KEYWORD ; } - case 122: break; + case 124: break; case 5: { return JetTokens.DIV ; } - case 123: break; + case 125: break; case 53: { return JetTokens.ELVIS ; } - case 124: break; + case 126: break; case 23: { return JetTokens.QUEST ; } - case 125: break; + case 127: break; case 51: { return JetTokens.OROR ; } - case 126: break; + case 128: break; case 19: { return JetTokens.PERC ; } - case 127: break; + case 129: break; case 46: { return JetTokens.PERCEQ ; } - case 128: break; + case 130: break; case 34: { return JetTokens.RANGE ; } - case 129: break; + case 131: break; case 1: { return TokenType.BAD_CHARACTER; } - case 130: break; + case 132: break; case 52: { return JetTokens.SAFE_ACCESS; } - case 131: break; - case 81: + case 133: break; + case 82: { return JetTokens.NAMESPACE_KEYWORD ; } - case 132: break; - case 83: + case 134: break; + case 84: { return JetTokens.DECOMPOSER_KEYWORD ; } - case 133: break; + case 135: break; case 6: { return JetTokens.MUL ; } - case 134: break; + case 136: break; case 12: { return JetTokens.RBRACKET ; } - case 135: break; + case 137: break; case 43: { return JetTokens.PLUSPLUS ; } - case 136: break; - case 68: + case 138: break; + case 69: { return JetTokens.THIS_KEYWORD ; } - case 137: break; + case 139: break; case 7: { return JetTokens.DOT ; } - case 138: break; + case 140: break; case 25: { return JetTokens.SEMICOLON ; } - case 139: break; + case 141: break; case 41: { return JetTokens.IF_KEYWORD ; } - case 140: break; + case 142: break; case 22: { return JetTokens.EQ ; } - case 141: break; + case 143: break; case 15: { return JetTokens.LPAR ; } - case 142: break; + case 144: break; case 8: { return JetTokens.MINUS ; } - case 143: break; - case 74: + case 145: break; + case 75: { return JetTokens.FALSE_KEYWORD ; } - case 144: break; - case 67: + case 146: break; + case 68: { return JetTokens.TYPE_KEYWORD ; } - case 145: break; - case 60: + case 147: break; + case 61: { return JetTokens.REF_KEYWORD ; } - case 146: break; - case 61: + case 148: break; + case 62: { return JetTokens.FUN_KEYWORD ; } - case 147: break; + case 149: break; case 40: { return JetTokens.IS_KEYWORD ; } - case 148: break; + case 150: break; case 31: { return JetTokens.DIVEQ ; } - case 149: break; - case 82: + case 151: break; + case 83: { return JetTokens.EXTENSION_KEYWORD ; } - case 150: break; + case 152: break; case 38: { return JetTokens.AS_KEYWORD ; } - case 151: break; - case 66: + case 153: break; + case 67: { return JetTokens.ELSE_KEYWORD ; } - case 152: break; + case 154: break; case 39: { return JetTokens.IN_KEYWORD ; } - case 153: break; + case 155: break; case 49: { return JetTokens.EQEQ ; } - case 154: break; - case 58: + case 156: break; + case 59: { return JetTokens.VAL_KEYWORD ; } - case 155: break; - case 64: + case 157: break; + case 65: { return JetTokens.EQEQEQ ; } - case 156: break; + case 158: break; case 57: { return JetTokens.NEW_KEYWORD ; } - case 157: break; + case 159: break; case 32: { return JetTokens.MULTEQ ; } - case 158: break; + case 160: break; case 10: { return JetTokens.STRING_LITERAL; } - case 159: break; + case 161: break; case 13: { return JetTokens.LBRACE ; } - case 160: break; - case 73: + case 162: break; + case 74: { return JetTokens.ISNOT_KEYWORD ; } - case 161: break; - case 79: + case 163: break; + case 80: { return JetTokens.OBJECT_KEYWORD ; } - case 162: break; - case 76: + case 164: break; + case 77: { return JetTokens.BREAK_KEYWORD ; } - case 163: break; + case 165: break; case 30: { return JetTokens.BLOCK_COMMENT; } - case 164: break; + case 166: break; case 35: { return JetTokens.FILTER ; } - case 165: break; + case 167: break; case 33: { return JetTokens.MAP ; } - case 166: break; + case 168: break; default: if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF = true;
57fcd761f2997629c75aac3617c0d97e80dcea0c
elasticsearch
Fix possible exception in toCamelCase method--
c
https://github.com/elastic/elasticsearch
diff --git a/src/main/java/org/elasticsearch/common/Strings.java b/src/main/java/org/elasticsearch/common/Strings.java index 45aa62f4246be..c2bfbfd046f71 100644 --- a/src/main/java/org/elasticsearch/common/Strings.java +++ b/src/main/java/org/elasticsearch/common/Strings.java @@ -1425,7 +1425,9 @@ public static String toCamelCase(String value, StringBuilder sb) { } changed = true; } - sb.append(Character.toUpperCase(value.charAt(++i))); + if (i < value.length() - 1) { + sb.append(Character.toUpperCase(value.charAt(++i))); + } } else { if (changed) { sb.append(c); diff --git a/src/test/java/org/elasticsearch/common/StringsTests.java b/src/test/java/org/elasticsearch/common/StringsTests.java new file mode 100644 index 0000000000000..e6f75aa9a1338 --- /dev/null +++ b/src/test/java/org/elasticsearch/common/StringsTests.java @@ -0,0 +1,36 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch 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.elasticsearch.common; + +import org.elasticsearch.test.ElasticsearchTestCase; +import org.junit.Test; + +public class StringsTests extends ElasticsearchTestCase { + + @Test + public void testToCamelCase() { + assertEquals("foo", Strings.toCamelCase("foo")); + assertEquals("fooBar", Strings.toCamelCase("fooBar")); + assertEquals("FooBar", Strings.toCamelCase("FooBar")); + assertEquals("fooBar", Strings.toCamelCase("foo_bar")); + assertEquals("fooBarFooBar", Strings.toCamelCase("foo_bar_foo_bar")); + assertEquals("fooBar", Strings.toCamelCase("foo_bar_")); + } +}
7d5216168878a13826d5475cbf933b7799224eb5
intellij-community
CPP-560 New Welcome Screen for CLion--
a
https://github.com/JetBrains/intellij-community
diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java index 786a5825e7837..b1b0db1fd0d74 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java @@ -107,11 +107,11 @@ public Dimension getPreferredSize() { JPanel progressPanel = new JPanel(new VerticalFlowLayout(true, false)); progressPanel.add(progressBar); final LinkLabel cancelLink = new LinkLabel("Cancel", AllIcons.Actions.Cancel); - JPanel linkWrapper = new JPanel(new FlowLayout(FlowLayout.CENTER)); + JPanel linkWrapper = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); linkWrapper.add(cancelLink); progressPanel.add(linkWrapper); - JPanel buttonPanel = new JPanel(new VerticalFlowLayout()); + JPanel buttonPanel = new JPanel(new VerticalFlowLayout(0, 0)); buttonPanel.add(installButton); buttonWrapper.add(buttonPanel, "button"); @@ -238,7 +238,7 @@ public void linkSelected(LinkLabel aSource, Object aLinkData) { protected Color getColor() { return ColorUtil.withAlpha(JBColor.foreground(), .2); } - }, BorderFactory.createEmptyBorder(GAP, GAP, 0, GAP))); + }, BorderFactory.createEmptyBorder(0, GAP / 2, 0, GAP / 2))); cursor++; }
26d12f78c550e45f32e2c0fd4cf625e3fbf3b295
restlet-framework-java
Add support for template route matching mode--
a
https://github.com/restlet/restlet-framework-java
diff --git a/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/IResourceProvider.java b/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/IResourceProvider.java index d901769620..605b8ee885 100644 --- a/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/IResourceProvider.java +++ b/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/IResourceProvider.java @@ -55,4 +55,10 @@ public interface IResourceProvider extends IRestletProvider { * paths must start with '/'. */ String[] getPaths(); + + /** + * + * @return the matching mode to be used for template routes. Defaults to Template.MODE_EQUALS. + */ + int getMatchingMode(); } diff --git a/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/ResourceProvider.java b/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/ResourceProvider.java index 0a264bdbf8..3161fc65f9 100644 --- a/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/ResourceProvider.java +++ b/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/ResourceProvider.java @@ -39,6 +39,7 @@ import org.restlet.Context; import org.restlet.Restlet; import org.restlet.resource.Finder; +import org.restlet.routing.Template; /** * @author Bryan Hunt @@ -49,11 +50,17 @@ public abstract class ResourceProvider extends RestletProvider implements private Finder finder; private String[] paths; - + + private Integer matchingMode; + protected void activate(ComponentContext context) { @SuppressWarnings("unchecked") Dictionary<String, Object> properties = context.getProperties(); paths = (String[]) properties.get("paths"); + matchingMode = (Integer) properties.get("matchingMode"); + + if (matchingMode == null) + matchingMode = Template.MODE_EQUALS; } protected abstract Finder createFinder(Context context); @@ -76,4 +83,9 @@ public Restlet getInboundRoot(Context context) { public String[] getPaths() { return paths.clone(); } + + @Override + public int getMatchingMode() { + return matchingMode; + } } diff --git a/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/RouterProvider.java b/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/RouterProvider.java index 0f5c5241ca..0e710ab8de 100644 --- a/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/RouterProvider.java +++ b/modules/org.restlet.ext.osgi/src/org/restlet/ext/osgi/RouterProvider.java @@ -38,6 +38,7 @@ import org.restlet.Context; import org.restlet.Restlet; import org.restlet.routing.Router; +import org.restlet.routing.TemplateRoute; /** * @author Bryan Hunt @@ -58,9 +59,10 @@ private void attachDirectory(IDirectoryProvider directoryProvider) { } private void attachResource(IResourceProvider resourceProvider) { - for (String path : resourceProvider.getPaths()) - router.attach(path, - resourceProvider.getInboundRoot(router.getContext())); + for (String path : resourceProvider.getPaths()) { + TemplateRoute templateRoute = router.attach(path, resourceProvider.getInboundRoot(router.getContext())); + templateRoute.setMatchingMode(resourceProvider.getMatchingMode()); + } } public void bindDefaultResourceProvider(IResourceProvider resourceProvider) {
7eb6b0fc4c0975ce708ce97632222ecb1129ed03
restlet-framework-java
- Initial code for enhanced internal HTTP- connectors.--
p
https://github.com/restlet/restlet-framework-java
diff --git a/incubator/org.restlet.ext.jxta/META-INF/MANIFEST.MF b/incubator/org.restlet.ext.jxta/META-INF/MANIFEST.MF index 038ef0bd74..de50ee7e6a 100644 --- a/incubator/org.restlet.ext.jxta/META-INF/MANIFEST.MF +++ b/incubator/org.restlet.ext.jxta/META-INF/MANIFEST.MF @@ -25,6 +25,7 @@ Import-Package: net.jxta, org.restlet.engine.application, org.restlet.engine.component, org.restlet.engine.http, + org.restlet.engine.http.stream, org.restlet.engine.local, org.restlet.engine.security, org.restlet.engine.util, diff --git a/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaClientCall.java b/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaClientCall.java index de63526fd6..e0f3c85419 100644 --- a/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaClientCall.java +++ b/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaClientCall.java @@ -37,7 +37,7 @@ import net.jxta.socket.JxtaSocket; import org.restlet.Request; -import org.restlet.engine.http.StreamClientCall; +import org.restlet.engine.http.stream.StreamClientCall; /** * JXTA HTTP client call. diff --git a/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaClientHelper.java b/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaClientHelper.java index b9085115e8..4e0e8334a6 100644 --- a/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaClientHelper.java +++ b/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaClientHelper.java @@ -35,7 +35,7 @@ import net.jxta.protocol.PipeAdvertisement; import org.restlet.Client; -import org.restlet.engine.http.StreamClientHelper; +import org.restlet.engine.http.stream.StreamClientHelper; /** * Abstract JXTA-based HTTP server connector helper. diff --git a/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaServerHelper.java b/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaServerHelper.java index 092f21be12..7ef6b15461 100644 --- a/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaServerHelper.java +++ b/incubator/org.restlet.ext.jxta/src/org/restlet/ext/jxta/JxtaServerHelper.java @@ -35,7 +35,7 @@ import net.jxta.protocol.PipeAdvertisement; import org.restlet.Server; -import org.restlet.engine.http.StreamServerHelper; +import org.restlet.engine.http.stream.StreamServerHelper; /** * Base JXTA connector. diff --git a/modules/org.restlet.ext.jaxrs/META-INF/MANIFEST.MF b/modules/org.restlet.ext.jaxrs/META-INF/MANIFEST.MF index 5954fe0c87..c74f0af20b 100644 --- a/modules/org.restlet.ext.jaxrs/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.jaxrs/META-INF/MANIFEST.MF @@ -72,6 +72,7 @@ Import-Package: javax.activation;version="1.1.1";resolution:=optional, org.restlet.engine.application, org.restlet.engine.component, org.restlet.engine.http, + org.restlet.engine.http.adapter, org.restlet.engine.http.header, org.restlet.engine.io, org.restlet.engine.local, diff --git a/modules/org.restlet.ext.jaxrs/src/org/restlet/ext/jaxrs/internal/util/Util.java b/modules/org.restlet.ext.jaxrs/src/org/restlet/ext/jaxrs/internal/util/Util.java index 249c84d92f..7ac9600d78 100644 --- a/modules/org.restlet.ext.jaxrs/src/org/restlet/ext/jaxrs/internal/util/Util.java +++ b/modules/org.restlet.ext.jaxrs/src/org/restlet/ext/jaxrs/internal/util/Util.java @@ -76,9 +76,9 @@ import org.restlet.data.MediaType; import org.restlet.data.Metadata; import org.restlet.data.Parameter; -import org.restlet.engine.http.ClientAdapter; import org.restlet.engine.http.ClientCall; -import org.restlet.engine.http.ServerAdapter; +import org.restlet.engine.http.adapter.ClientAdapter; +import org.restlet.engine.http.adapter.ServerAdapter; import org.restlet.engine.http.header.ContentType; import org.restlet.engine.http.header.HeaderUtils; import org.restlet.engine.util.DateUtils; diff --git a/modules/org.restlet.ext.servlet/META-INF/MANIFEST.MF b/modules/org.restlet.ext.servlet/META-INF/MANIFEST.MF index d9c014022f..58539deafb 100644 --- a/modules/org.restlet.ext.servlet/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.servlet/META-INF/MANIFEST.MF @@ -22,6 +22,7 @@ Import-Package: javax.servlet, org.restlet.engine.application, org.restlet.engine.component, org.restlet.engine.http, + org.restlet.engine.http.adapter, org.restlet.engine.http.header, org.restlet.engine.local, org.restlet.engine.security, diff --git a/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletAdapter.java b/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletAdapter.java index c1ec8af5c5..fad501652d 100644 --- a/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletAdapter.java +++ b/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletAdapter.java @@ -43,7 +43,7 @@ import org.restlet.data.Reference; import org.restlet.engine.http.HttpRequest; import org.restlet.engine.http.HttpResponse; -import org.restlet.engine.http.ServerAdapter; +import org.restlet.engine.http.adapter.ServerAdapter; import org.restlet.ext.servlet.internal.ServletCall; import org.restlet.ext.servlet.internal.ServletLogger; diff --git a/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletConverter.java b/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletConverter.java index d68f9e78af..d60652b12f 100644 --- a/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletConverter.java +++ b/modules/org.restlet.ext.servlet/src/org/restlet/ext/servlet/ServletConverter.java @@ -43,7 +43,7 @@ import org.restlet.data.Reference; import org.restlet.engine.http.HttpRequest; import org.restlet.engine.http.HttpResponse; -import org.restlet.engine.http.ServerAdapter; +import org.restlet.engine.http.adapter.ServerAdapter; import org.restlet.ext.servlet.internal.ServletCall; import org.restlet.ext.servlet.internal.ServletLogger; diff --git a/modules/org.restlet.ext.xdb/META-INF/MANIFEST.MF b/modules/org.restlet.ext.xdb/META-INF/MANIFEST.MF index 7d9d29e748..bf3867a329 100644 --- a/modules/org.restlet.ext.xdb/META-INF/MANIFEST.MF +++ b/modules/org.restlet.ext.xdb/META-INF/MANIFEST.MF @@ -25,6 +25,7 @@ Import-Package: javax.servlet, org.restlet.engine.application, org.restlet.engine.component, org.restlet.engine.http, + org.restlet.engine.http.adapter, org.restlet.engine.http.io, org.restlet.engine.io, org.restlet.engine.local, diff --git a/modules/org.restlet.ext.xdb/src/org/restlet/ext/xdb/XdbServletAdapter.java b/modules/org.restlet.ext.xdb/src/org/restlet/ext/xdb/XdbServletAdapter.java index ed45fc0b25..e7141a0820 100644 --- a/modules/org.restlet.ext.xdb/src/org/restlet/ext/xdb/XdbServletAdapter.java +++ b/modules/org.restlet.ext.xdb/src/org/restlet/ext/xdb/XdbServletAdapter.java @@ -47,7 +47,7 @@ import org.restlet.data.Reference; import org.restlet.engine.http.HttpRequest; import org.restlet.engine.http.HttpResponse; -import org.restlet.engine.http.ServerAdapter; +import org.restlet.engine.http.adapter.ServerAdapter; import org.restlet.ext.servlet.internal.ServletLogger; import org.restlet.ext.xdb.internal.XdbServletCall; diff --git a/modules/org.restlet.ext.xdb/src/org/restlet/ext/xdb/XdbServletConverter.java b/modules/org.restlet.ext.xdb/src/org/restlet/ext/xdb/XdbServletConverter.java index 6553dd35a5..3ca878a8d1 100644 --- a/modules/org.restlet.ext.xdb/src/org/restlet/ext/xdb/XdbServletConverter.java +++ b/modules/org.restlet.ext.xdb/src/org/restlet/ext/xdb/XdbServletConverter.java @@ -47,7 +47,7 @@ import org.restlet.data.Reference; import org.restlet.engine.http.HttpRequest; import org.restlet.engine.http.HttpResponse; -import org.restlet.engine.http.ServerAdapter; +import org.restlet.engine.http.adapter.ServerAdapter; import org.restlet.ext.servlet.internal.ServletLogger; import org.restlet.ext.xdb.internal.XdbServletCall; diff --git a/modules/org.restlet.test/src/org/restlet/test/engine/BaseConnectorsTestCase.java b/modules/org.restlet.test/src/org/restlet/test/engine/BaseConnectorsTestCase.java index 08778a1b00..2906b9b2c0 100644 --- a/modules/org.restlet.test/src/org/restlet/test/engine/BaseConnectorsTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/engine/BaseConnectorsTestCase.java @@ -37,8 +37,8 @@ import org.restlet.engine.ClientHelper; import org.restlet.engine.Engine; import org.restlet.engine.ServerHelper; -import org.restlet.engine.http.StreamClientHelper; -import org.restlet.engine.http.StreamServerHelper; +import org.restlet.engine.http.stream.StreamClientHelper; +import org.restlet.engine.http.stream.StreamServerHelper; import org.restlet.test.RestletTestCase; /** diff --git a/modules/org.restlet/META-INF/MANIFEST.MF b/modules/org.restlet/META-INF/MANIFEST.MF index 81259ea6d9..c89891d46b 100644 --- a/modules/org.restlet/META-INF/MANIFEST.MF +++ b/modules/org.restlet/META-INF/MANIFEST.MF @@ -21,7 +21,6 @@ Export-Package: org.restlet; org.restlet.security", org.restlet.engine; uses:="org.restlet.engine.log, - org.restlet.representation, org.restlet, org.restlet.engine.security, org.restlet.util, @@ -50,20 +49,39 @@ Export-Package: org.restlet; org.restlet.engine", org.restlet.engine.http; uses:="org.restlet.representation, - org.restlet.util, org.restlet, + org.restlet.util, org.restlet.engine, + org.restlet.engine.http.adapter, org.restlet.service, - javax.net, org.restlet.data", + org.restlet.engine.http.adapter; + uses:="org.restlet.data, + org.restlet.engine.http, + org.restlet.representation, + org.restlet, + org.restlet.util", + org.restlet.engine.http.connector; + uses:="org.restlet.representation, + org.restlet, + org.restlet.util, + org.restlet.engine, + org.restlet.data, + org.restlet.engine.http", org.restlet.engine.http.header;uses:="org.restlet.data,org.restlet.representation,org.restlet.util", - org.restlet.engine.http.io, + org.restlet.engine.http.io;uses:="org.restlet.representation,org.restlet.util", org.restlet.engine.http.security; uses:="org.restlet.data, org.restlet.engine.http.header, org.restlet.engine.security, org.restlet.util, org.restlet", + org.restlet.engine.http.stream; + uses:="javax.net, + org.restlet.data, + org.restlet.engine.http, + org.restlet.representation, + org.restlet", org.restlet.engine.internal;uses:="org.osgi.framework", org.restlet.engine.io;uses:="org.restlet.data,org.restlet.representation", org.restlet.engine.local; diff --git a/modules/org.restlet/module.xml b/modules/org.restlet/module.xml index bbe4ad0d7f..f93c74d0db 100644 --- a/modules/org.restlet/module.xml +++ b/modules/org.restlet/module.xml @@ -21,9 +21,12 @@ <export>org.restlet.engine.component</export> <export>org.restlet.engine.converter</export> <export>org.restlet.engine.http</export> + <export>org.restlet.engine.http.adapter</export> + <export>org.restlet.engine.http.connector</export> <export>org.restlet.engine.http.header</export> <export>org.restlet.engine.http.io</export> <export>org.restlet.engine.http.security</export> + <export>org.restlet.engine.http.stream</export> <export>org.restlet.engine.io</export> <export>org.restlet.engine.local</export> <export>org.restlet.engine.riap</export> @@ -71,9 +74,8 @@ <exclude name="META-INF/MANIFEST.MF" /> <exclude name="src/com/**" /> <exclude name="src/org/restlet/engine/internal/Activator.java" /> - <exclude name="src/org/restlet/engine/http/Connection*.java" /> - <exclude name="src/org/restlet/engine/http/StreamServer*" /> - <exclude name="src/org/restlet/engine/http/StreamClient*" /> + <exclude name="src/org/restlet/engine/http/connector/**" /> + <exclude name="src/org/restlet/engine/http/stream/**" /> <exclude name="src/org/restlet/engine/log/IdentClient.java" /> <exclude name="src/org/restlet/service/TaskService.java" /> ]]> @@ -109,15 +111,14 @@ <exclude name="src/org/restlet/engine/TemplateDispatcher.java" /> <exclude name="src/org/restlet/engine/component/**" /> <exclude name="src/org/restlet/engine/converter/**" /> - <exclude name="src/org/restlet/engine/http/Connection*.java" /> <exclude name="src/org/restlet/engine/http/HttpRequest.java" /> <exclude name="src/org/restlet/engine/http/HttpResponse*.java" /> <exclude name="src/org/restlet/engine/http/HttpServer*.java" /> <exclude name="src/org/restlet/engine/http/Server*" /> - <exclude name="src/org/restlet/engine/http/StreamServer*" /> - <exclude name="src/org/restlet/engine/http/StreamClient*" /> + <exclude name="src/org/restlet/engine/http/connector/**" /> <exclude name="src/org/restlet/engine/http/io/**" /> <exclude name="src/org/restlet/engine/http/security/**" /> + <exclude name="src/org/restlet/engine/http/stream/**" /> <exclude name="src/org/restlet/engine/internal/**" /> <exclude name="src/org/restlet/engine/io/BioUtils.java" /> <exclude name="src/org/restlet/engine/local/**" /> diff --git a/modules/org.restlet/src/org/restlet/engine/Engine.java b/modules/org.restlet/src/org/restlet/engine/Engine.java index 2fc7b330b0..ea574ea973 100644 --- a/modules/org.restlet/src/org/restlet/engine/Engine.java +++ b/modules/org.restlet/src/org/restlet/engine/Engine.java @@ -638,7 +638,7 @@ public void registerDefaultAuthentications() { public void registerDefaultConnectors() { // [ifndef gae, gwt] getRegisteredClients().add( - new org.restlet.engine.http.StreamClientHelper(null)); + new org.restlet.engine.http.stream.StreamClientHelper(null)); // [enddef] // [ifndef gwt] getRegisteredClients().add( @@ -654,7 +654,7 @@ public void registerDefaultConnectors() { // [enddef] // [ifndef gae, gwt] getRegisteredServers().add( - new org.restlet.engine.http.StreamServerHelper(null)); + new org.restlet.engine.http.stream.StreamServerHelper(null)); // [enddef] // [ifdef gwt] uncomment // getRegisteredClients().add( diff --git a/modules/org.restlet/src/org/restlet/engine/http/ClientCall.java b/modules/org.restlet/src/org/restlet/engine/http/ClientCall.java index 8410ba2921..449f27485d 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/ClientCall.java +++ b/modules/org.restlet/src/org/restlet/engine/http/ClientCall.java @@ -44,6 +44,7 @@ import org.restlet.data.Parameter; import org.restlet.data.Status; import org.restlet.data.Tag; +import org.restlet.engine.http.adapter.ClientAdapter; import org.restlet.engine.http.header.ContentType; import org.restlet.engine.http.header.DispositionReader; import org.restlet.engine.http.header.HeaderReader; diff --git a/modules/org.restlet/src/org/restlet/engine/http/HttpClientHelper.java b/modules/org.restlet/src/org/restlet/engine/http/HttpClientHelper.java index d3640b1a99..7cd0147c9f 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/HttpClientHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/http/HttpClientHelper.java @@ -38,6 +38,7 @@ import org.restlet.Response; import org.restlet.data.Status; import org.restlet.engine.ClientHelper; +import org.restlet.engine.http.adapter.ClientAdapter; /** * Base HTTP client connector. Here is the list of parameters that are diff --git a/modules/org.restlet/src/org/restlet/engine/http/HttpServerHelper.java b/modules/org.restlet/src/org/restlet/engine/http/HttpServerHelper.java index 34668e1f0e..0f2028753c 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/HttpServerHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/http/HttpServerHelper.java @@ -37,6 +37,7 @@ import org.restlet.Server; import org.restlet.engine.Engine; import org.restlet.engine.ServerHelper; +import org.restlet.engine.http.adapter.ServerAdapter; /** * Base HTTP server connector. Here is the list of parameters that are diff --git a/modules/org.restlet/src/org/restlet/engine/http/Adapter.java b/modules/org.restlet/src/org/restlet/engine/http/adapter/Adapter.java similarity index 99% rename from modules/org.restlet/src/org/restlet/engine/http/Adapter.java rename to modules/org.restlet/src/org/restlet/engine/http/adapter/Adapter.java index 838e753425..542c699ce0 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/Adapter.java +++ b/modules/org.restlet/src/org/restlet/engine/http/adapter/Adapter.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.adapter; import java.util.logging.Logger; diff --git a/modules/org.restlet/src/org/restlet/engine/http/ClientAdapter.java b/modules/org.restlet/src/org/restlet/engine/http/adapter/ClientAdapter.java similarity index 99% rename from modules/org.restlet/src/org/restlet/engine/http/ClientAdapter.java rename to modules/org.restlet/src/org/restlet/engine/http/adapter/ClientAdapter.java index f969eb1858..b9efdf3320 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/ClientAdapter.java +++ b/modules/org.restlet/src/org/restlet/engine/http/adapter/ClientAdapter.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.adapter; import java.io.IOException; import java.util.Date; @@ -53,6 +53,8 @@ import org.restlet.data.Warning; import org.restlet.engine.Edition; import org.restlet.engine.Engine; +import org.restlet.engine.http.ClientCall; +import org.restlet.engine.http.HttpClientHelper; import org.restlet.engine.http.header.CacheControlReader; import org.restlet.engine.http.header.CacheControlUtils; import org.restlet.engine.http.header.CookieReader; diff --git a/modules/org.restlet/src/org/restlet/engine/http/ServerAdapter.java b/modules/org.restlet/src/org/restlet/engine/http/adapter/ServerAdapter.java similarity index 99% rename from modules/org.restlet/src/org/restlet/engine/http/ServerAdapter.java rename to modules/org.restlet/src/org/restlet/engine/http/adapter/ServerAdapter.java index ccc5c098fc..df8c3085a2 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/ServerAdapter.java +++ b/modules/org.restlet/src/org/restlet/engine/http/adapter/ServerAdapter.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.adapter; import java.io.IOException; import java.security.cert.Certificate; @@ -49,6 +49,10 @@ import org.restlet.data.Parameter; import org.restlet.data.Status; import org.restlet.data.Warning; +import org.restlet.engine.http.Call; +import org.restlet.engine.http.HttpRequest; +import org.restlet.engine.http.HttpResponse; +import org.restlet.engine.http.ServerCall; import org.restlet.engine.http.header.CacheControlUtils; import org.restlet.engine.http.header.CookieUtils; import org.restlet.engine.http.header.DispositionUtils; diff --git a/modules/org.restlet/src/org/restlet/engine/http/adapter/package.html b/modules/org.restlet/src/org/restlet/engine/http/adapter/package.html new file mode 100644 index 0000000000..8b4319ce38 --- /dev/null +++ b/modules/org.restlet/src/org/restlet/engine/http/adapter/package.html @@ -0,0 +1,7 @@ +<HTML> +<BODY> +New advanced internal HTTP connector. +<p> +@since Restlet 2.0 +</BODY> +</HTML> \ No newline at end of file diff --git a/modules/org.restlet/src/org/restlet/engine/http/Connection.java b/modules/org.restlet/src/org/restlet/engine/http/connector/Connection.java similarity index 95% rename from modules/org.restlet/src/org/restlet/engine/http/Connection.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/Connection.java index 80fbb6731f..3e5c8649ed 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/Connection.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/Connection.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; diff --git a/modules/org.restlet/src/org/restlet/engine/http/ConnectionState.java b/modules/org.restlet/src/org/restlet/engine/http/connector/ConnectionState.java similarity index 94% rename from modules/org.restlet/src/org/restlet/engine/http/ConnectionState.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/ConnectionState.java index d8353875d3..baef77acf0 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/ConnectionState.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/ConnectionState.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; /** * Enumeration of the states of a connection. diff --git a/modules/org.restlet/src/org/restlet/engine/http/InternalRequest.java b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalRequest.java similarity index 96% rename from modules/org.restlet/src/org/restlet/engine/http/InternalRequest.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/InternalRequest.java index bd2beee6e6..0e30d6801d 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/InternalRequest.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalRequest.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; import java.security.Principal; import java.security.cert.Certificate; @@ -51,6 +51,7 @@ import org.restlet.data.Reference; import org.restlet.data.Tag; import org.restlet.data.Warning; +import org.restlet.engine.http.Call; import org.restlet.engine.http.header.CacheControlReader; import org.restlet.engine.http.header.CookieReader; import org.restlet.engine.http.header.HeaderReader; diff --git a/modules/org.restlet/src/org/restlet/engine/http/InternalResponse.java b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalResponse.java similarity index 94% rename from modules/org.restlet/src/org/restlet/engine/http/InternalResponse.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/InternalResponse.java index ece046434c..2d62beda91 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/InternalResponse.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalResponse.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; import org.restlet.Request; import org.restlet.Response; @@ -36,6 +36,7 @@ import org.restlet.data.ServerInfo; import org.restlet.data.Status; import org.restlet.engine.Engine; +import org.restlet.engine.http.ServerCall; import org.restlet.engine.http.header.HeaderConstants; import org.restlet.util.Series; diff --git a/modules/org.restlet/src/org/restlet/engine/http/InternalServerCall.java b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerCall.java similarity index 96% rename from modules/org.restlet/src/org/restlet/engine/http/InternalServerCall.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerCall.java index fb549d2427..549ce0aa8b 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/InternalServerCall.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerCall.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; import java.io.InputStream; import java.io.OutputStream; diff --git a/modules/org.restlet/src/org/restlet/engine/http/InternalServerConnection.java b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerConnection.java similarity index 96% rename from modules/org.restlet/src/org/restlet/engine/http/InternalServerConnection.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerConnection.java index edd881ba76..4134b1145e 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/InternalServerConnection.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerConnection.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; import java.io.IOException; import java.net.Socket; diff --git a/modules/org.restlet/src/org/restlet/engine/http/InternalServerHandler.java b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerHandler.java similarity index 93% rename from modules/org.restlet/src/org/restlet/engine/http/InternalServerHandler.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerHandler.java index 08cb2d388f..bf2a4a0f36 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/InternalServerHandler.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerHandler.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -36,6 +36,8 @@ import java.net.Socket; import java.util.logging.Level; +import org.restlet.engine.http.stream.StreamServerCall; + /** * Class that handles an incoming socket. * diff --git a/modules/org.restlet/src/org/restlet/engine/http/InternalServerHelper.java b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerHelper.java similarity index 95% rename from modules/org.restlet/src/org/restlet/engine/http/InternalServerHelper.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerHelper.java index 23720f10d6..df23191843 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/InternalServerHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerHelper.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; import java.io.IOException; import java.net.InetSocketAddress; @@ -43,6 +43,7 @@ import org.restlet.Server; import org.restlet.data.Protocol; +import org.restlet.engine.http.HttpServerHelper; import org.restlet.engine.log.LoggingThreadFactory; /** diff --git a/modules/org.restlet/src/org/restlet/engine/http/InternalServerListener.java b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerListener.java similarity index 96% rename from modules/org.restlet/src/org/restlet/engine/http/InternalServerListener.java rename to modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerListener.java index 205eaee32e..0d8e462ea6 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/InternalServerListener.java +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/InternalServerListener.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.connector; import java.io.IOException; import java.nio.channels.ClosedByInterruptException; diff --git a/modules/org.restlet/src/org/restlet/engine/http/connector/package.html b/modules/org.restlet/src/org/restlet/engine/http/connector/package.html new file mode 100644 index 0000000000..8b4319ce38 --- /dev/null +++ b/modules/org.restlet/src/org/restlet/engine/http/connector/package.html @@ -0,0 +1,7 @@ +<HTML> +<BODY> +New advanced internal HTTP connector. +<p> +@since Restlet 2.0 +</BODY> +</HTML> \ No newline at end of file diff --git a/modules/org.restlet/src/org/restlet/engine/http/StreamClientCall.java b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamClientCall.java similarity index 99% rename from modules/org.restlet/src/org/restlet/engine/http/StreamClientCall.java rename to modules/org.restlet/src/org/restlet/engine/http/stream/StreamClientCall.java index 415b7228c8..6d858464b8 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/StreamClientCall.java +++ b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamClientCall.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.stream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -49,6 +49,7 @@ import org.restlet.data.Parameter; import org.restlet.data.Reference; import org.restlet.data.Status; +import org.restlet.engine.http.ClientCall; import org.restlet.engine.http.header.HeaderUtils; import org.restlet.engine.http.header.HeaderConstants; import org.restlet.engine.http.io.ChunkedInputStream; diff --git a/modules/org.restlet/src/org/restlet/engine/http/StreamClientHelper.java b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamClientHelper.java similarity index 98% rename from modules/org.restlet/src/org/restlet/engine/http/StreamClientHelper.java rename to modules/org.restlet/src/org/restlet/engine/http/stream/StreamClientHelper.java index d652a9394e..4529877c3e 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/StreamClientHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamClientHelper.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.stream; import java.io.File; import java.io.FileInputStream; @@ -49,6 +49,8 @@ import org.restlet.Client; import org.restlet.Request; import org.restlet.data.Protocol; +import org.restlet.engine.http.ClientCall; +import org.restlet.engine.http.HttpClientHelper; /** * HTTP client helper based on BIO sockets. Here is the list of parameters that diff --git a/modules/org.restlet/src/org/restlet/engine/http/ConnectionHandler.java b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamHandler.java similarity index 90% rename from modules/org.restlet/src/org/restlet/engine/http/ConnectionHandler.java rename to modules/org.restlet/src/org/restlet/engine/http/stream/StreamHandler.java index 99e4bc3659..00e7c4e8fb 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/ConnectionHandler.java +++ b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamHandler.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.stream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -41,7 +41,7 @@ * * @author Jerome Louvel */ -public class ConnectionHandler implements Runnable { +public class StreamHandler implements Runnable { /** The target server helper. */ private final StreamServerHelper helper; @@ -57,7 +57,7 @@ public class ConnectionHandler implements Runnable { * @param socket * The socket connection to handle. */ - public ConnectionHandler(StreamServerHelper helper, Socket socket) { + public StreamHandler(StreamServerHelper helper, Socket socket) { this.helper = helper; this.socket = socket; } diff --git a/modules/org.restlet/src/org/restlet/engine/http/ConnectionListener.java b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamListener.java similarity index 91% rename from modules/org.restlet/src/org/restlet/engine/http/ConnectionListener.java rename to modules/org.restlet/src/org/restlet/engine/http/stream/StreamListener.java index 14527a52db..c45b8d0b42 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/ConnectionListener.java +++ b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamListener.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.stream; import java.io.IOException; import java.nio.channels.ClosedByInterruptException; @@ -44,7 +44,7 @@ * * @author Jerome Louvel */ -public class ConnectionListener implements Runnable { +public class StreamListener implements Runnable { /** The target server helper. */ private final StreamServerHelper helper; @@ -73,7 +73,7 @@ public class ConnectionListener implements Runnable { * @param handlerService * The handler service. */ - public ConnectionListener(StreamServerHelper helper, + public StreamListener(StreamServerHelper helper, ServerSocketChannel serverSocket, CountDownLatch latch, ExecutorService handlerService) { this.helper = helper; @@ -92,7 +92,7 @@ public void run() { SocketChannel client = this.serverSocket.accept(); if (!this.handlerService.isShutdown()) { - this.handlerService.submit(new ConnectionHandler( + this.handlerService.submit(new StreamHandler( this.helper, client.socket())); } } catch (ClosedByInterruptException ex) { diff --git a/modules/org.restlet/src/org/restlet/engine/http/StreamServerCall.java b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamServerCall.java similarity index 98% rename from modules/org.restlet/src/org/restlet/engine/http/StreamServerCall.java rename to modules/org.restlet/src/org/restlet/engine/http/stream/StreamServerCall.java index d99d5fb043..bf956caf05 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/StreamServerCall.java +++ b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamServerCall.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.stream; import java.io.IOException; import java.io.InputStream; @@ -42,6 +42,7 @@ import org.restlet.Response; import org.restlet.Server; +import org.restlet.engine.http.ServerCall; import org.restlet.engine.http.io.ChunkedInputStream; import org.restlet.engine.http.io.ChunkedOutputStream; import org.restlet.engine.http.io.InputEntityStream; diff --git a/modules/org.restlet/src/org/restlet/engine/http/StreamServerHelper.java b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamServerHelper.java similarity index 97% rename from modules/org.restlet/src/org/restlet/engine/http/StreamServerHelper.java rename to modules/org.restlet/src/org/restlet/engine/http/stream/StreamServerHelper.java index 3f73842859..5c49dbe53f 100644 --- a/modules/org.restlet/src/org/restlet/engine/http/StreamServerHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/http/stream/StreamServerHelper.java @@ -28,7 +28,7 @@ * Restlet is a registered trademark of Noelios Technologies. */ -package org.restlet.engine.http; +package org.restlet.engine.http.stream; import java.io.IOException; import java.net.InetSocketAddress; @@ -43,6 +43,7 @@ import org.restlet.Server; import org.restlet.data.Protocol; +import org.restlet.engine.http.HttpServerHelper; import org.restlet.engine.log.LoggingThreadFactory; /** @@ -121,7 +122,7 @@ public synchronized void start() throws Exception { // Start the socket listener service this.latch = new CountDownLatch(1); - this.listenerService.submit(new ConnectionListener(this, + this.listenerService.submit(new StreamListener(this, this.serverSocketChannel, this.latch, this.handlerService)); // Wait for the listener to start up and count down the latch diff --git a/modules/org.restlet/src/org/restlet/engine/http/stream/package.html b/modules/org.restlet/src/org/restlet/engine/http/stream/package.html new file mode 100644 index 0000000000..bec1a53870 --- /dev/null +++ b/modules/org.restlet/src/org/restlet/engine/http/stream/package.html @@ -0,0 +1,7 @@ +<HTML> +<BODY> +Internal HTTP connector. +<p> +@since Restlet 2.0 +</BODY> +</HTML> \ No newline at end of file
6236c422615cfe33795267214077551f3d9ffa6f
camel
CAMEL-1977: Http based components should filter- out camel internal headers.--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@814567 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/camel
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java index a32be75c50c52..37e81e5c902f3 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java @@ -45,6 +45,7 @@ protected void initialize() { setLowerCase(true); // filter headers begin with "Camel" or "org.apache.camel" - setOutFilterPattern("(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*"); + // must ignore case for Http based transports + setOutFilterPattern("(?i)(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*"); } } diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java new file mode 100644 index 0000000000000..40861c7fcc891 --- /dev/null +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java @@ -0,0 +1,80 @@ +/** + * 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.apache.camel.component.jetty; + +import java.util.Map; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.impl.JndiRegistry; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +/** + * @version $Revision$ + */ +public class HttpFilterCamelHeadersTest extends CamelTestSupport { + + @Test + public void testFilterCamelHeaders() throws Exception { + Exchange out = template.send("http://localhost:9090/test/filter", new Processor() { + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody("Claus"); + exchange.getIn().setHeader("bar", 123); + } + }); + + assertNotNull(out); + assertEquals("Hi Claus", out.getOut().getBody(String.class)); + + // there should be no internal Camel headers + // except for the response code + Map<String, Object> headers = out.getOut().getHeaders(); + for (String key : headers.keySet()) { + if (!key.equalsIgnoreCase(Exchange.HTTP_RESPONSE_CODE)) { + assertTrue("Should not contain any Camel internal headers", !key.toLowerCase().startsWith("camel")); + } else { + assertEquals(200, headers.get(Exchange.HTTP_RESPONSE_CODE)); + } + } + } + + @Override + protected JndiRegistry createRegistry() throws Exception { + JndiRegistry jndi = super.createRegistry(); + jndi.bind("foo", new MyFooBean()); + return jndi; + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("jetty:http://localhost:9090/test/filter").beanRef("foo"); + } + }; + } + + public static class MyFooBean { + + public String hello(String name) { + return "Hi " + name; + } + } +}
3b21d391c5c01c2b753bd777e5cc6e9d5af7137a
kotlin
Add test for lookups to classifier members--
p
https://github.com/JetBrains/kotlin
diff --git a/jps-plugin/test/org/jetbrains/kotlin/jps/build/LookupTrackerTestGenerated.java b/jps-plugin/test/org/jetbrains/kotlin/jps/build/LookupTrackerTestGenerated.java index 401d4211141de..4b1bd5a3648fc 100644 --- a/jps-plugin/test/org/jetbrains/kotlin/jps/build/LookupTrackerTestGenerated.java +++ b/jps-plugin/test/org/jetbrains/kotlin/jps/build/LookupTrackerTestGenerated.java @@ -35,6 +35,12 @@ public void testAllFilesPresentInLookupTracker() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/lookupTracker"), Pattern.compile("^([^\\.]+)$"), true); } + @TestMetadata("classifierMembers") + public void testClassifierMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/lookupTracker/classifierMembers/"); + doTest(fileName); + } + @TestMetadata("packageDeclarations") public void testPackageDeclarations() throws Exception { String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/lookupTracker/packageDeclarations/"); diff --git a/jps-plugin/testData/incremental/lookupTracker/classifierMembers/bar.kt b/jps-plugin/testData/incremental/lookupTracker/classifierMembers/bar.kt new file mode 100644 index 0000000000000..ddac0faf273bc --- /dev/null +++ b/jps-plugin/testData/incremental/lookupTracker/classifierMembers/bar.kt @@ -0,0 +1 @@ +package bar diff --git a/jps-plugin/testData/incremental/lookupTracker/classifierMembers/foo.kt b/jps-plugin/testData/incremental/lookupTracker/classifierMembers/foo.kt new file mode 100644 index 0000000000000..d05d400947671 --- /dev/null +++ b/jps-plugin/testData/incremental/lookupTracker/classifierMembers/foo.kt @@ -0,0 +1,94 @@ +package foo + +import bar.* + +/*p:foo*/class A { + val a = 1 + var b = "" + + val c: /*c:foo.A p:foo*/String + get() = /*c:foo.A p:foo p:bar c:foo.A.Companion*/b + + var d: /*c:foo.A p:foo*/String = "ddd" + get() = /*c:foo.A p:foo p:bar c:foo.A.Companion*/$d + set(v) { /*c:foo.A p:foo p:bar c:foo.A.Companion*/$d = v } + + fun foo() { + /*c:foo.A p:foo p:bar c:foo.A.Companion*/a + /*c:foo.A p:foo p:bar c:foo.A.Companion*/foo() + this./*c:foo.A*/a + this./*c:foo.A*/foo() + /*c:foo.A p:foo p:bar c:foo.A.Companion*/baz() + /*c:foo.A p:foo p:bar c:foo.A.Companion*/Companion./*c:foo.A.Companion*/a + /*c:foo.A p:foo p:bar c:foo.A.Companion*/O./*c:foo.A.O*/v = "OK" + } + + class B { + val a = 1 + + companion object CO { + fun bar(a: /*c:foo.A.B.CO c:foo.A.B c:foo.A p:foo*/Int) {} + } + } + + companion object { + val a = 1 + fun baz() {} + } + + object O { + var v = "vvv" + } +} + +/*p:foo*/interface I { + var a: /*c:foo.I p:foo*/Int + fun foo() +} + +/*p:foo*/object Obj : /*p:foo*/I { + override var a = 1 + override fun foo() {} + val b = 1 + fun bar(): /*c:foo.Obj p:foo*/I = null as /*c:foo.Obj p:foo*/I +} + +/*p:foo*/enum class E { + X, + Y; + + val a = 1 + fun foo() { + /*c:foo.E p:foo p:bar*/a + /*c:foo.E p:foo p:bar*/Y./*c:foo.E*/a + /*c:foo.E p:foo p:bar*/foo() + /*c:foo.E p:foo p:bar*/X./*c:foo.E*/foo() + } +} + +/*p:foo*/fun usages(i: /*p:foo*/I) { + /*p:foo p:bar*/A()./*c:foo.A*/a + /*p:foo p:bar*/A()./*c:foo.A*/b + /*p:foo p:bar*/A()./*c:foo.A*/c + /*p:foo p:bar*/A()./*c:foo.A*/d = "new value" + /*p:foo p:bar*/A()./*c:foo.A*/foo() + /*p:foo p:bar*/A./*c:foo.A*/B()./*c:foo.A.B*/a + /*p:foo p:bar*/A./*c:foo.A*/B./*c:foo.A.B c:foo.A.B.CO*/bar(1) + /*p:foo p:bar*/A./*c:foo.A*/B./*c:foo.A.B*/CO./*c:foo.A.B.CO*/bar(1) + /*p:foo p:bar*/A./*c:foo.A c:foo.A.Companion*/a + /*p:foo p:bar*/A./*c:foo.A c:foo.A.Companion*/baz() + /*p:foo p:bar*/A./*c:foo.A*/Companion./*c:foo.A.Companion*/baz() + /*p:foo p:bar*/A./*c:foo.A*/O./*c:foo.A.O*/v = "OK" + i./*c:foo.I*/a = 2 + /*p:foo p:bar*/Obj./*c:foo.Obj*/a + /*p:foo p:bar*/Obj./*c:foo.Obj*/foo() + var ii: /*p:foo*/I = /*p:foo p:bar*/Obj + ii./*c:foo.I*/a + ii./*c:foo.I*/foo() + /*p:foo p:bar*/Obj./*c:foo.Obj*/b + val iii = /*p:foo p:bar*/Obj./*c:foo.Obj*/bar() + iii./*c:foo.I*/foo() + /*p:foo p:bar*/E./*c:foo.E*/X + /*p:foo p:bar*/E./*c:foo.E*/X./*c:foo.E*/a + /*p:foo p:bar*/E./*c:foo.E*/Y./*c:foo.E*/foo() +}
f1be5f4addf30f47b1d915ca708566bf49beb7f8
ReactiveX-RxJava
Non-blocking implementation of ScheduledObserver--
a
https://github.com/ReactiveX/RxJava
diff --git a/rxjava-core/src/main/java/rx/operators/ScheduledObserver.java b/rxjava-core/src/main/java/rx/operators/ScheduledObserver.java index 3c3592ec9e..a7f1dc2878 100644 --- a/rxjava-core/src/main/java/rx/operators/ScheduledObserver.java +++ b/rxjava-core/src/main/java/rx/operators/ScheduledObserver.java @@ -21,13 +21,14 @@ import rx.util.functions.Action0; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicInteger; /* package */class ScheduledObserver<T> implements Observer<T> { private final Observer<T> underlying; private final Scheduler scheduler; private final ConcurrentLinkedQueue<Notification<T>> queue = new ConcurrentLinkedQueue<Notification<T>>(); - private final Object lock = new Object(); + private final AtomicInteger counter = new AtomicInteger(0); public ScheduledObserver(Observer<T> underlying, Scheduler scheduler) { this.underlying = underlying; @@ -50,48 +51,43 @@ public void onNext(final T args) { } private void enqueue(Notification<T> notification) { - boolean schedule; - synchronized (lock) { - schedule = queue.isEmpty(); + int count = counter.getAndIncrement(); - queue.offer(notification); + queue.offer(notification); + + if (count == 0) { + processQueue(); } + } - if (schedule) { - scheduler.schedule(new Action0() { - @Override - public void call() { - Notification<T> not = dequeue(); - - if (not == null) { - return; - } - - switch (not.getKind()) { - case OnNext: - underlying.onNext(not.getValue()); - break; - case OnError: - underlying.onError(not.getException()); - break; - case OnCompleted: - underlying.onCompleted(); - break; - default: - throw new IllegalStateException("Unknown kind of notification " + not); - - } + private void processQueue() { + scheduler.schedule(new Action0() { + @Override + public void call() { + int count = counter.decrementAndGet(); + + Notification<T> not = queue.poll(); + + switch (not.getKind()) { + case OnNext: + underlying.onNext(not.getValue()); + break; + case OnError: + underlying.onError(not.getException()); + break; + case OnCompleted: + underlying.onCompleted(); + break; + default: + throw new IllegalStateException("Unknown kind of notification " + not); - scheduler.schedule(this); + } + if (count > 0) { + scheduler.schedule(this); } - }); - } - } - private Notification<T> dequeue() { - synchronized (lock) { - return queue.poll(); - } + } + }); } }
fcfdfbbc6516d92624f5af9dc5556f6143df757f
orientdb
implementing math operations--
a
https://github.com/orientechnologies/orientdb
diff --git a/core/src/main/grammar/OrientSQL.jjt b/core/src/main/grammar/OrientSQL.jjt index cdf20c5d084..d632af335d3 100644 --- a/core/src/main/grammar/OrientSQL.jjt +++ b/core/src/main/grammar/OrientSQL.jjt @@ -561,8 +561,8 @@ void ProjectionItem(): LOOKAHEAD( InputParameter() ) InputParameter() | - LOOKAHEAD( OperationChain() ) - OperationChain() + LOOKAHEAD( Expression() ) + Expression() ) [<AS> Alias() ] ) @@ -613,8 +613,8 @@ void FilterItem(): LOOKAHEAD( InputParameter() ) InputParameter() | - LOOKAHEAD( OperationChain() ) - OperationChain() + LOOKAHEAD( Expression() ) + Expression() } void ArraySelector(): @@ -634,8 +634,8 @@ void ArraySelector(): LOOKAHEAD( InputParameter() ) InputParameter() | - LOOKAHEAD( OperationChain() ) - OperationChain() + LOOKAHEAD( Expression() ) + Expression() } void ArraySingleValuesSelector(): @@ -654,8 +654,8 @@ void ArrayRangeSelector(): LOOKAHEAD( InputParameter() ) InputParameter() | - LOOKAHEAD( OperationChain() ) - OperationChain() + LOOKAHEAD( Expression() ) + Expression() ) <MINUS> ( @@ -665,8 +665,8 @@ void ArrayRangeSelector(): LOOKAHEAD( InputParameter() ) InputParameter() | - LOOKAHEAD( OperationChain() ) - OperationChain() + LOOKAHEAD( Expression() ) + Expression() ) } @@ -766,15 +766,86 @@ void Modifier(): LOOKAHEAD(3) <DOT> SuffixIdentifier() ) - [ Modifier() ] + [ + LOOKAHEAD( Modifier() ) + Modifier() + ] } -void OperationChain(): +void Expression(): {} { - BaseIdentifier() [ Modifier() ] + LOOKAHEAD( AddExpression() ) + AddExpression() } + + + + + + + + + + + + + + +void AddExpression(): +{} +{ + MultExpression() ( ( <PLUS> | <MINUS> ) MultExpression() )* +} + +void MultExpression(): +{} +{ + FirstLevelExpression() ( ( <STAR> | <SLASH> ) FirstLevelExpression() )* +} + +void FirstLevelExpression(): +{} +{ + LOOKAHEAD( ParenthesisExpression() ) + ParenthesisExpression() + | + LOOKAHEAD( BaseExpression() ) + BaseExpression() +} + +void ParenthesisExpression(): +{} +{ + <LPAREN> AddExpression() <RPAREN> +} + +void BaseExpression(): +{} +{ + BaseIdentifier() [ LOOKAHEAD( Modifier() ) Modifier() ] +} + + + + + + + + + + + + + + + + + + + + void FromClause(): {} @@ -846,7 +917,7 @@ void AndBlock(): void NotBlock(): {} { - [ <NOT> ] ( ConditionBlock() | ParenthesisBlock() ) + [ LOOKAHEAD(2) <NOT> ] ( LOOKAHEAD(ConditionBlock()) ConditionBlock() | LOOKAHEAD(ParenthesisBlock()) ParenthesisBlock() ) } void ParenthesisBlock(): @@ -991,8 +1062,10 @@ void ContainsValueCondition(): { FilterItem() ContainsValueOperator() ( + LOOKAHEAD( 3 ) <LPAREN> OrBlock() <RPAREN> | + LOOKAHEAD( FilterItem() ) FilterItem() ) } @@ -1050,8 +1123,10 @@ void ContainsCondition(): FilterItem() <CONTAINS> ( + LOOKAHEAD( 3 ) <LPAREN> OrBlock() <RPAREN> | + LOOKAHEAD( FilterItem() ) FilterItem() ) @@ -1096,7 +1171,7 @@ void ContainsAllCondition(): void ContainsTextCondition(): {} { - FilterItem() <CONTAINSTEXT> ( <STRING_LITERAL> | OperationChain() ) + FilterItem() <CONTAINSTEXT> ( <STRING_LITERAL> | Expression() ) } void MatchesCondition(): diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAddExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAddExpression.java new file mode 100644 index 00000000000..925e389beb2 --- /dev/null +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OAddExpression.java @@ -0,0 +1,21 @@ +/* Generated By:JJTree: Do not edit this line. OAddExpression.java Version 4.3 */ +/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package com.orientechnologies.orient.core.sql.parser; + +public +class OAddExpression extends SimpleNode { + public OAddExpression(int id) { + super(id); + } + + public OAddExpression(OrientSql p, int id) { + super(p, id); + } + + + /** Accept the visitor. **/ + public Object jjtAccept(OrientSqlVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} +/* JavaCC - OriginalChecksum=f5b6dfc729cb26c6b861dea74bd1f741 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOperationChain.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseExpression.java similarity index 64% rename from core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOperationChain.java rename to core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseExpression.java index eb341a29798..797fc81206a 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OOperationChain.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OBaseExpression.java @@ -1,14 +1,14 @@ -/* Generated By:JJTree: Do not edit this line. OOperationChain.java Version 4.3 */ +/* Generated By:JJTree: Do not edit this line. OBaseExpression.java Version 4.3 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.orientechnologies.orient.core.sql.parser; public -class OOperationChain extends SimpleNode { - public OOperationChain(int id) { +class OBaseExpression extends SimpleNode { + public OBaseExpression(int id) { super(id); } - public OOperationChain(OrientSql p, int id) { + public OBaseExpression(OrientSql p, int id) { super(p, id); } @@ -18,4 +18,4 @@ public Object jjtAccept(OrientSqlVisitor visitor, Object data) { return visitor.visit(this, data); } } -/* JavaCC - OriginalChecksum=4ebb6dfc48342982e67746cf94a81adc (do not edit this line) */ +/* JavaCC - OriginalChecksum=71b3e2d1b65c923dc7cfe11f9f449d2b (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExpression.java new file mode 100644 index 00000000000..587d334aa70 --- /dev/null +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OExpression.java @@ -0,0 +1,21 @@ +/* Generated By:JJTree: Do not edit this line. OExpression.java Version 4.3 */ +/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package com.orientechnologies.orient.core.sql.parser; + +public +class OExpression extends SimpleNode { + public OExpression(int id) { + super(id); + } + + public OExpression(OrientSql p, int id) { + super(p, id); + } + + + /** Accept the visitor. **/ + public Object jjtAccept(OrientSqlVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} +/* JavaCC - OriginalChecksum=9c860224b121acdc89522ae97010be01 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFirstLevelExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFirstLevelExpression.java new file mode 100644 index 00000000000..a12867691aa --- /dev/null +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OFirstLevelExpression.java @@ -0,0 +1,21 @@ +/* Generated By:JJTree: Do not edit this line. OFirstLevelExpression.java Version 4.3 */ +/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package com.orientechnologies.orient.core.sql.parser; + +public +class OFirstLevelExpression extends SimpleNode { + public OFirstLevelExpression(int id) { + super(id); + } + + public OFirstLevelExpression(OrientSql p, int id) { + super(p, id); + } + + + /** Accept the visitor. **/ + public Object jjtAccept(OrientSqlVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} +/* JavaCC - OriginalChecksum=30dc1016b686d4841bbd57d6e6c0bfbd (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMultExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMultExpression.java new file mode 100644 index 00000000000..06f82f63be9 --- /dev/null +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OMultExpression.java @@ -0,0 +1,21 @@ +/* Generated By:JJTree: Do not edit this line. OMultExpression.java Version 4.3 */ +/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package com.orientechnologies.orient.core.sql.parser; + +public +class OMultExpression extends SimpleNode { + public OMultExpression(int id) { + super(id); + } + + public OMultExpression(OrientSql p, int id) { + super(p, id); + } + + + /** Accept the visitor. **/ + public Object jjtAccept(OrientSqlVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} +/* JavaCC - OriginalChecksum=f75b8be48dca1e0cafae0cacadc608c8 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisExpression.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisExpression.java new file mode 100644 index 00000000000..2605cbea267 --- /dev/null +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OParenthesisExpression.java @@ -0,0 +1,21 @@ +/* Generated By:JJTree: Do not edit this line. OParenthesisExpression.java Version 4.3 */ +/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package com.orientechnologies.orient.core.sql.parser; + +public +class OParenthesisExpression extends SimpleNode { + public OParenthesisExpression(int id) { + super(id); + } + + public OParenthesisExpression(OrientSql p, int id) { + super(p, id); + } + + + /** Accept the visitor. **/ + public Object jjtAccept(OrientSqlVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} +/* JavaCC - OriginalChecksum=4656e5faf4f54dc3fc45a06d8e375c35 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSql.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSql.java index 2b4689e72b7..66e8ac7fac8 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSql.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSql.java @@ -286,6 +286,7 @@ final public void SelectStatement() throws ParseException { case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: + case LPAREN: case LBRACKET: case HOOK: case COLON: @@ -408,6 +409,7 @@ final public void TraverseStatement() throws ParseException { case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: + case LPAREN: case LBRACKET: case HOOK: case COLON: @@ -1019,6 +1021,7 @@ final public void ProjectionItem() throws ParseException { case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: + case LPAREN: case LBRACKET: case HOOK: case COLON: @@ -1051,7 +1054,7 @@ final public void ProjectionItem() throws ParseException { if (jj_2_11(2147483647)) { InputParameter(); } else if (jj_2_12(2147483647)) { - OperationChain(); + Expression(); } else { jj_consume_token(-1); throw new ParseException(); @@ -1209,7 +1212,7 @@ final public void FilterItem() throws ParseException { if (jj_2_17(2147483647)) { InputParameter(); } else if (jj_2_18(2147483647)) { - OperationChain(); + Expression(); } else { jj_consume_token(-1); throw new ParseException(); @@ -1268,7 +1271,7 @@ final public void ArraySelector() throws ParseException { if (jj_2_20(2147483647)) { InputParameter(); } else if (jj_2_21(2147483647)) { - OperationChain(); + Expression(); } else { jj_consume_token(-1); throw new ParseException(); @@ -1352,7 +1355,7 @@ final public void ArrayRangeSelector() throws ParseException { } else if (jj_2_23(2147483647)) { InputParameter(); } else if (jj_2_24(2147483647)) { - OperationChain(); + Expression(); } else { jj_consume_token(-1); throw new ParseException(); @@ -1363,7 +1366,7 @@ final public void ArrayRangeSelector() throws ParseException { } else if (jj_2_26(2147483647)) { InputParameter(); } else if (jj_2_27(2147483647)) { - OperationChain(); + Expression(); } else { jj_consume_token(-1); throw new ParseException(); @@ -1505,6 +1508,7 @@ final public void FunctionCall() throws ParseException { case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: + case LPAREN: case LBRACKET: case HOOK: case COLON: @@ -1578,6 +1582,7 @@ final public void MethodCall() throws ParseException { case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: + case LPAREN: case LBRACKET: case HOOK: case COLON: @@ -1791,13 +1796,9 @@ final public void Modifier() throws ParseException { throw new ParseException(); } } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LBRACKET: - case DOT: + if (jj_2_36(2147483647)) { Modifier(); - break; - default: - jj_la1[52] = jj_gen; + } else { ; } } catch (Throwable jjte000) { @@ -1822,21 +1823,232 @@ final public void Modifier() throws ParseException { } } - final public void OperationChain() throws ParseException { - /*@bgen(jjtree) OperationChain */ - OOperationChain jjtn000 = new OOperationChain(JJTOPERATIONCHAIN); + final public void Expression() throws ParseException { + /*@bgen(jjtree) Expression */ + OExpression jjtn000 = new OExpression(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + if (jj_2_37(2147483647)) { + + } else { + jj_consume_token(-1); + throw new ParseException(); + } + AddExpression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void AddExpression() throws ParseException { + /*@bgen(jjtree) AddExpression */ + OAddExpression jjtn000 = new OAddExpression(JJTADDEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + MultExpression(); + label_11: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + case MINUS: + ; + break; + default: + jj_la1[52] = jj_gen; + break label_11; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + jj_consume_token(PLUS); + break; + case MINUS: + jj_consume_token(MINUS); + break; + default: + jj_la1[53] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + MultExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void MultExpression() throws ParseException { + /*@bgen(jjtree) MultExpression */ + OMultExpression jjtn000 = new OMultExpression(JJTMULTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + FirstLevelExpression(); + label_12: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: + case SLASH: + ; + break; + default: + jj_la1[54] = jj_gen; + break label_12; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: + jj_consume_token(STAR); + break; + case SLASH: + jj_consume_token(SLASH); + break; + default: + jj_la1[55] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + FirstLevelExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void FirstLevelExpression() throws ParseException { + /*@bgen(jjtree) FirstLevelExpression */ + OFirstLevelExpression jjtn000 = new OFirstLevelExpression(JJTFIRSTLEVELEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + if (jj_2_38(2147483647)) { + ParenthesisExpression(); + } else if (jj_2_39(2147483647)) { + BaseExpression(); + } else { + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void ParenthesisExpression() throws ParseException { + /*@bgen(jjtree) ParenthesisExpression */ + OParenthesisExpression jjtn000 = new OParenthesisExpression(JJTPARENTHESISEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(LPAREN); + AddExpression(); + jj_consume_token(RPAREN); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void BaseExpression() throws ParseException { + /*@bgen(jjtree) BaseExpression */ + OBaseExpression jjtn000 = new OBaseExpression(JJTBASEEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { BaseIdentifier(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LBRACKET: - case DOT: + if (jj_2_40(2147483647)) { Modifier(); - break; - default: - jj_la1[53] = jj_gen; + } else { ; } } catch (Throwable jjte000) { @@ -1906,15 +2118,15 @@ final public void FromItem() throws ParseException { case LBRACKET: jj_consume_token(LBRACKET); Rid(); - label_11: + label_13: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[54] = jj_gen; - break label_11; + jj_la1[56] = jj_gen; + break label_13; } jj_consume_token(COMMA); Rid(); @@ -1952,14 +2164,14 @@ final public void FromItem() throws ParseException { TraverseStatement(); break; default: - jj_la1[55] = jj_gen; + jj_la1[57] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(RPAREN); break; default: - jj_la1[56] = jj_gen; + jj_la1[58] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2038,7 +2250,7 @@ final public void IndexIdentifier() throws ParseException { jj_consume_token(INDEXVALUESDESC_IDENTIFIER); break; default: - jj_la1[57] = jj_gen; + jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2088,15 +2300,15 @@ final public void OrBlock() throws ParseException { jjtn000.jjtSetFirstToken(getToken(1)); try { AndBlock(); - label_12: + label_14: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OR: ; break; default: - jj_la1[58] = jj_gen; - break label_12; + jj_la1[60] = jj_gen; + break label_14; } jj_consume_token(OR); AndBlock(); @@ -2131,15 +2343,15 @@ final public void AndBlock() throws ParseException { jjtn000.jjtSetFirstToken(getToken(1)); try { NotBlock(); - label_13: + label_15: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case AND: ; break; default: - jj_la1[59] = jj_gen; - break label_13; + jj_la1[61] = jj_gen; + break label_15; } jj_consume_token(AND); NotBlock(); @@ -2173,41 +2385,16 @@ final public void NotBlock() throws ParseException { jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NOT: + if (jj_2_41(2)) { jj_consume_token(NOT); - break; - default: - jj_la1[60] = jj_gen; + } else { ; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SET: - case NULL: - case ORDER: - case GROUP: - case OFFSET: - case THIS: - case RECORD_ATTRIBUTE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case LBRACKET: - case HOOK: - case COLON: - case MINUS: - case IN: - case KEY: - case IDENTIFIER: - case 118: + if (jj_2_42(2147483647)) { ConditionBlock(); - break; - case LPAREN: + } else if (jj_2_43(2147483647)) { ParenthesisBlock(); - break; - default: - jj_la1[61] = jj_gen; + } else { jj_consume_token(-1); throw new ParseException(); } @@ -2272,35 +2459,35 @@ final public void ConditionBlock() throws ParseException { jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { - if (jj_2_36(2147483647)) { + if (jj_2_44(2147483647)) { IsNotNullCondition(); - } else if (jj_2_37(2147483647)) { + } else if (jj_2_45(2147483647)) { IsNullCondition(); - } else if (jj_2_38(2147483647)) { + } else if (jj_2_46(2147483647)) { IsNotDefinedCondition(); - } else if (jj_2_39(2147483647)) { + } else if (jj_2_47(2147483647)) { IsDefinedCondition(); - } else if (jj_2_40(2147483647)) { + } else if (jj_2_48(2147483647)) { InCondition(); - } else if (jj_2_41(2147483647)) { + } else if (jj_2_49(2147483647)) { NotInCondition(); - } else if (jj_2_42(2147483647)) { + } else if (jj_2_50(2147483647)) { BinaryCondition(); - } else if (jj_2_43(2147483647)) { + } else if (jj_2_51(2147483647)) { BetweenCondition(); - } else if (jj_2_44(2147483647)) { + } else if (jj_2_52(2147483647)) { ContainsCondition(); - } else if (jj_2_45(2147483647)) { + } else if (jj_2_53(2147483647)) { ContainsValueCondition(); - } else if (jj_2_46(2147483647)) { + } else if (jj_2_54(2147483647)) { ContainsAllCondition(); - } else if (jj_2_47(2147483647)) { + } else if (jj_2_55(2147483647)) { ContainsTextCondition(); - } else if (jj_2_48(2147483647)) { + } else if (jj_2_56(2147483647)) { MatchesCondition(); - } else if (jj_2_49(2147483647)) { + } else if (jj_2_57(2147483647)) { IndexMatchCondition(); - } else if (jj_2_50(2147483647)) { + } else if (jj_2_58(2147483647)) { InstanceofCondition(); } else { jj_consume_token(-1); @@ -2591,35 +2778,13 @@ final public void ContainsValueCondition() throws ParseException { try { FilterItem(); ContainsValueOperator(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LPAREN: + if (jj_2_59(3)) { jj_consume_token(LPAREN); OrBlock(); jj_consume_token(RPAREN); - break; - case SET: - case NULL: - case ORDER: - case GROUP: - case OFFSET: - case THIS: - case RECORD_ATTRIBUTE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case LBRACKET: - case HOOK: - case COLON: - case MINUS: - case IN: - case KEY: - case IDENTIFIER: - case 118: + } else if (jj_2_60(2147483647)) { FilterItem(); - break; - default: - jj_la1[63] = jj_gen; + } else { jj_consume_token(-1); throw new ParseException(); } @@ -2709,6 +2874,7 @@ final public void IndexMatchCondition() throws ParseException { case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: + case LPAREN: case LBRACKET: case HOOK: case COLON: @@ -2718,22 +2884,22 @@ final public void IndexMatchCondition() throws ParseException { case IDENTIFIER: case 118: FilterItem(); - label_14: + label_16: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[64] = jj_gen; - break label_14; + jj_la1[63] = jj_gen; + break label_16; } jj_consume_token(COMMA); FilterItem(); } break; default: - jj_la1[65] = jj_gen; + jj_la1[64] = jj_gen; ; } jj_consume_token(RBRACKET); @@ -2753,6 +2919,7 @@ final public void IndexMatchCondition() throws ParseException { case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: + case LPAREN: case LBRACKET: case HOOK: case COLON: @@ -2762,22 +2929,22 @@ final public void IndexMatchCondition() throws ParseException { case IDENTIFIER: case 118: FilterItem(); - label_15: + label_17: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[66] = jj_gen; - break label_15; + jj_la1[65] = jj_gen; + break label_17; } jj_consume_token(COMMA); FilterItem(); } break; default: - jj_la1[67] = jj_gen; + jj_la1[66] = jj_gen; ; } jj_consume_token(RBRACKET); @@ -2795,6 +2962,7 @@ final public void IndexMatchCondition() throws ParseException { case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: + case LPAREN: case LBRACKET: case HOOK: case COLON: @@ -2804,28 +2972,28 @@ final public void IndexMatchCondition() throws ParseException { case IDENTIFIER: case 118: FilterItem(); - label_16: + label_18: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[68] = jj_gen; - break label_16; + jj_la1[67] = jj_gen; + break label_18; } jj_consume_token(COMMA); FilterItem(); } break; default: - jj_la1[69] = jj_gen; + jj_la1[68] = jj_gen; ; } jj_consume_token(RBRACKET); break; default: - jj_la1[70] = jj_gen; + jj_la1[69] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3024,35 +3192,13 @@ final public void ContainsCondition() throws ParseException { try { FilterItem(); jj_consume_token(CONTAINS); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LPAREN: + if (jj_2_61(3)) { jj_consume_token(LPAREN); OrBlock(); jj_consume_token(RPAREN); - break; - case SET: - case NULL: - case ORDER: - case GROUP: - case OFFSET: - case THIS: - case RECORD_ATTRIBUTE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case LBRACKET: - case HOOK: - case COLON: - case MINUS: - case IN: - case KEY: - case IDENTIFIER: - case 118: + } else if (jj_2_62(2147483647)) { FilterItem(); - break; - default: - jj_la1[71] = jj_gen; + } else { jj_consume_token(-1); throw new ParseException(); } @@ -3107,15 +3253,15 @@ final public void InCondition() throws ParseException { case LBRACKET: jj_consume_token(LBRACKET); FilterItem(); - label_17: + label_19: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[72] = jj_gen; - break label_17; + jj_la1[70] = jj_gen; + break label_19; } jj_consume_token(COMMA); FilterItem(); @@ -3132,7 +3278,7 @@ final public void InCondition() throws ParseException { InputParameter(); break; default: - jj_la1[73] = jj_gen; + jj_la1[71] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3172,15 +3318,15 @@ final public void NotInCondition() throws ParseException { case LBRACKET: jj_consume_token(LBRACKET); FilterItem(); - label_18: + label_20: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[74] = jj_gen; - break label_18; + jj_la1[72] = jj_gen; + break label_20; } jj_consume_token(COMMA); FilterItem(); @@ -3193,7 +3339,7 @@ final public void NotInCondition() throws ParseException { jj_consume_token(RPAREN); break; default: - jj_la1[75] = jj_gen; + jj_la1[73] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3272,14 +3418,15 @@ final public void ContainsTextCondition() throws ParseException { case OFFSET: case THIS: case RECORD_ATTRIBUTE: + case LPAREN: case LBRACKET: case IN: case KEY: case IDENTIFIER: - OperationChain(); + Expression(); break; default: - jj_la1[76] = jj_gen; + jj_la1[74] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3364,7 +3511,7 @@ final public void OrderBy() throws ParseException { jj_consume_token(RECORD_ATTRIBUTE); break; default: - jj_la1[77] = jj_gen; + jj_la1[75] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3379,24 +3526,24 @@ final public void OrderBy() throws ParseException { jj_consume_token(ASC); break; default: - jj_la1[78] = jj_gen; + jj_la1[76] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[79] = jj_gen; + jj_la1[77] = jj_gen; ; } - label_19: + label_21: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[80] = jj_gen; - break label_19; + jj_la1[78] = jj_gen; + break label_21; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -3417,7 +3564,7 @@ final public void OrderBy() throws ParseException { jj_consume_token(RECORD_ATTRIBUTE); break; default: - jj_la1[81] = jj_gen; + jj_la1[79] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3432,13 +3579,13 @@ final public void OrderBy() throws ParseException { jj_consume_token(ASC); break; default: - jj_la1[82] = jj_gen; + jj_la1[80] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[83] = jj_gen; + jj_la1[81] = jj_gen; ; } } @@ -3474,15 +3621,15 @@ final public void GroupBy() throws ParseException { jj_consume_token(GROUP); jj_consume_token(BY); Identifier(); - label_20: + label_22: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[84] = jj_gen; - break label_20; + jj_la1[82] = jj_gen; + break label_22; } jj_consume_token(COMMA); Identifier(); @@ -3557,7 +3704,7 @@ final public void Skip() throws ParseException { Integer(); break; default: - jj_la1[85] = jj_gen; + jj_la1[83] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3592,15 +3739,15 @@ final public void ItemsCollection() throws ParseException { try { jj_consume_token(LBRACKET); ValueItem(); - label_21: + label_23: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: - jj_la1[86] = jj_gen; - break label_21; + jj_la1[84] = jj_gen; + break label_23; } jj_consume_token(COMMA); ValueItem(); @@ -3978,95 +4125,158 @@ private boolean jj_2_50(int xla) { finally { jj_save(49, xla); } } - private boolean jj_3R_170() { - if (jj_3R_23()) return true; + private boolean jj_2_51(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_51(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(50, xla); } + } + + private boolean jj_2_52(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_52(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(51, xla); } + } + + private boolean jj_2_53(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_53(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(52, xla); } + } + + private boolean jj_2_54(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_54(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(53, xla); } + } + + private boolean jj_2_55(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_55(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(54, xla); } + } + + private boolean jj_2_56(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_56(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(55, xla); } + } + + private boolean jj_2_57(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_57(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(56, xla); } + } + + private boolean jj_2_58(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_58(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(57, xla); } + } + + private boolean jj_2_59(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_59(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(58, xla); } + } + + private boolean jj_2_60(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_60(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(59, xla); } + } + + private boolean jj_2_61(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_61(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(60, xla); } + } + + private boolean jj_2_62(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_62(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(61, xla); } + } + + private boolean jj_3R_188() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_101() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_146()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_147()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(RBRACKET)) return true; + private boolean jj_3R_99() { + if (jj_scan_token(IN)) return true; return false; } - private boolean jj_3R_143() { + private boolean jj_3R_106() { + if (jj_3R_56()) return true; + return false; + } + + private boolean jj_3R_80() { if (jj_scan_token(LBRACKET)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_174()) { + if (jj_3R_134()) { jj_scanpos = xsp; - if (jj_3R_175()) { + if (jj_3R_135()) { jj_scanpos = xsp; - if (jj_3R_176()) return true; + if (jj_3R_136()) return true; } } if (jj_scan_token(RBRACKET)) return true; return false; } - private boolean jj_3R_173() { - if (jj_scan_token(OFFSET)) return true; - if (jj_3R_24()) return true; - return false; - } - - private boolean jj_3R_172() { - if (jj_scan_token(SKIP2)) return true; - if (jj_3R_24()) return true; + private boolean jj_3_30() { + if (jj_3R_31()) return true; return false; } - private boolean jj_3R_139() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_172()) { - jj_scanpos = xsp; - if (jj_3R_173()) return true; - } + private boolean jj_3_61() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_32()) return true; + if (jj_scan_token(RPAREN)) return true; return false; } - private boolean jj_3_30() { - if (jj_3R_29()) return true; + private boolean jj_3R_189() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_56()) return true; return false; } private boolean jj_3_29() { - if (jj_3R_28()) return true; + if (jj_3R_30()) return true; return false; } - private boolean jj_3R_186() { - if (jj_3R_72()) return true; + private boolean jj_3R_178() { + if (jj_3R_56()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_208()) { jj_scanpos = xsp; break; } + if (jj_3R_207()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_161() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_72()) return true; - return false; - } - - private boolean jj_3R_134() { - if (jj_3R_59()) return true; - return false; - } - - private boolean jj_3R_99() { + private boolean jj_3R_36() { Token xsp; xsp = jj_scanpos; - if (jj_3R_143()) { + if (jj_3R_80()) { jj_scanpos = xsp; if (jj_3_34()) { jj_scanpos = xsp; @@ -4074,126 +4284,97 @@ private boolean jj_3R_99() { } } xsp = jj_scanpos; - if (jj_3R_144()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_141() { - if (jj_scan_token(LIMIT)) return true; - if (jj_3R_24()) return true; - return false; - } - - private boolean jj_3R_169() { - if (jj_3R_59()) return true; + if (jj_3R_81()) jj_scanpos = xsp; return false; } - private boolean jj_3R_98() { - if (jj_3R_29()) return true; + private boolean jj_3R_49() { + if (jj_3R_56()) return true; + if (jj_scan_token(CONTAINS)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3_61()) { + jj_scanpos = xsp; + if (jj_3R_106()) return true; + } return false; } - private boolean jj_3R_92() { - if (jj_scan_token(GROUP)) return true; - if (jj_scan_token(BY)) return true; - if (jj_3R_59()) return true; + private boolean jj_3R_150() { + if (jj_3R_56()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_138()) { jj_scanpos = xsp; break; } + if (jj_3R_188()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_24() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(76)) jj_scanpos = xsp; - if (jj_scan_token(INTEGER_LITERAL)) return true; + private boolean jj_3R_138() { + if (jj_3R_31()) return true; return false; } - private boolean jj_3R_57() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_97()) { - jj_scanpos = xsp; - if (jj_3R_98()) return true; - } + private boolean jj_3R_43() { + if (jj_3R_56()) return true; + if (jj_scan_token(IS)) return true; + if (jj_scan_token(NOT)) return true; + if (jj_scan_token(DEFINED)) return true; return false; } - private boolean jj_3R_97() { - if (jj_3R_28()) return true; + private boolean jj_3R_137() { + if (jj_3R_30()) return true; return false; } - private boolean jj_3R_145() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_72()) return true; + private boolean jj_3R_26() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(76)) jj_scanpos = xsp; + if (jj_scan_token(INTEGER_LITERAL)) return true; return false; } - private boolean jj_3R_137() { - if (jj_scan_token(COMMA)) return true; + private boolean jj_3R_82() { Token xsp; xsp = jj_scanpos; - if (jj_3R_169()) { - jj_scanpos = xsp; - if (jj_3R_170()) { + if (jj_3R_137()) { jj_scanpos = xsp; - if (jj_scan_token(32)) return true; - } + if (jj_3R_138()) return true; } - xsp = jj_scanpos; - if (jj_3R_171()) jj_scanpos = xsp; return false; } - private boolean jj_3R_112() { + private boolean jj_3R_173() { if (jj_scan_token(COMMA)) return true; - if (jj_3R_72()) return true; + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_124() { - if (jj_3R_72()) return true; + private boolean jj_3R_151() { + if (jj_3R_56()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_161()) { jj_scanpos = xsp; break; } + if (jj_3R_189()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_91() { - if (jj_scan_token(ORDER)) return true; - if (jj_scan_token(BY)) return true; + private boolean jj_3R_44() { + if (jj_3R_56()) return true; + if (jj_scan_token(IS)) return true; + if (jj_scan_token(DEFINED)) return true; + return false; + } + + private boolean jj_3R_67() { Token xsp; xsp = jj_scanpos; - if (jj_3R_134()) { + if (jj_scan_token(109)) { jj_scanpos = xsp; - if (jj_3R_135()) { - jj_scanpos = xsp; - if (jj_scan_token(32)) return true; - } - } - xsp = jj_scanpos; - if (jj_3R_136()) jj_scanpos = xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_137()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_59() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(109)) { - jj_scanpos = xsp; - if (jj_scan_token(97)) { + if (jj_scan_token(97)) { jj_scanpos = xsp; if (jj_scan_token(15)) { jj_scanpos = xsp; @@ -4213,74 +4394,64 @@ private boolean jj_3R_59() { return false; } - private boolean jj_3R_63() { - if (jj_3R_102()) return true; + private boolean jj_3R_71() { + if (jj_3R_128()) return true; return false; } - private boolean jj_3R_29() { + private boolean jj_3R_31() { Token xsp; xsp = jj_scanpos; - if (jj_3R_62()) { + if (jj_3R_70()) { jj_scanpos = xsp; - if (jj_3R_63()) return true; + if (jj_3R_71()) return true; } return false; } - private boolean jj_3R_62() { - if (jj_3R_59()) return true; - return false; - } - - private boolean jj_3R_46() { - if (jj_3R_72()) return true; - if (jj_scan_token(MATCHES)) return true; - if (jj_scan_token(STRING_LITERAL)) return true; + private boolean jj_3R_70() { + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_61() { - if (jj_3R_101()) return true; + private boolean jj_3R_41() { + if (jj_3R_56()) return true; + if (jj_scan_token(IS)) return true; + if (jj_scan_token(NOT)) return true; + if (jj_scan_token(NULL)) return true; return false; } - private boolean jj_3_2() { - if (jj_scan_token(INTEGER_LITERAL)) return true; - if (jj_scan_token(COLON)) return true; - if (jj_scan_token(INTEGER_LITERAL)) return true; + private boolean jj_3R_69() { + if (jj_3R_127()) return true; return false; } - private boolean jj_3R_100() { - if (jj_3R_72()) return true; + private boolean jj_3R_126() { + if (jj_3R_56()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_145()) { jj_scanpos = xsp; break; } + if (jj_3R_173()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_111() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_72()) return true; + private boolean jj_3_2() { + if (jj_scan_token(INTEGER_LITERAL)) return true; + if (jj_scan_token(COLON)) return true; + if (jj_scan_token(INTEGER_LITERAL)) return true; return false; } - private boolean jj_3R_45() { - if (jj_3R_72()) return true; - if (jj_scan_token(CONTAINSTEXT)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(49)) { - jj_scanpos = xsp; - if (jj_3R_85()) return true; - } + private boolean jj_3R_42() { + if (jj_3R_56()) return true; + if (jj_scan_token(IS)) return true; + if (jj_scan_token(NULL)) return true; return false; } - private boolean jj_3R_23() { + private boolean jj_3R_25() { Token xsp; xsp = jj_scanpos; if (jj_3_1()) { @@ -4298,410 +4469,322 @@ private boolean jj_3_1() { return false; } - private boolean jj_3R_28() { + private boolean jj_3R_30() { Token xsp; xsp = jj_scanpos; if (jj_3_28()) { jj_scanpos = xsp; if (jj_scan_token(31)) { jj_scanpos = xsp; - if (jj_3R_61()) return true; + if (jj_3R_69()) return true; } } return false; } private boolean jj_3_28() { - if (jj_3R_27()) return true; + if (jj_3R_29()) return true; return false; } - private boolean jj_3R_33() { + private boolean jj_3R_35() { if (jj_scan_token(DOT)) return true; - if (jj_3R_59()) return true; + if (jj_3R_67()) return true; if (jj_scan_token(LPAREN)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_186()) jj_scanpos = xsp; + if (jj_3R_178()) jj_scanpos = xsp; if (jj_scan_token(RPAREN)) return true; return false; } - private boolean jj_3R_44() { - if (jj_3R_72()) return true; - if (jj_scan_token(CONTAINSALL)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_30()) return true; - if (jj_scan_token(RPAREN)) return true; + private boolean jj_3R_48() { + if (jj_3R_56()) return true; + if (jj_scan_token(BETWEEN)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(AND)) return true; + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_60() { + private boolean jj_3R_111() { + if (jj_scan_token(BETWEEN)) return true; + if (jj_scan_token(LBRACKET)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_100()) jj_scanpos = xsp; + if (jj_3R_151()) jj_scanpos = xsp; + if (jj_scan_token(RBRACKET)) return true; + if (jj_scan_token(AND)) return true; + if (jj_scan_token(LBRACKET)) return true; + xsp = jj_scanpos; + if (jj_3R_152()) jj_scanpos = xsp; + if (jj_scan_token(RBRACKET)) return true; return false; } - private boolean jj_3R_77() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_72()) return true; + private boolean jj_3R_68() { Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_112()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(RBRACKET)) return true; + xsp = jj_scanpos; + if (jj_3R_126()) jj_scanpos = xsp; return false; } - private boolean jj_3R_78() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_22()) return true; - if (jj_scan_token(RPAREN)) return true; + private boolean jj_3R_110() { + if (jj_3R_105()) return true; + if (jj_scan_token(LBRACKET)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_150()) jj_scanpos = xsp; + if (jj_scan_token(RBRACKET)) return true; return false; } - private boolean jj_3R_39() { - if (jj_3R_72()) return true; - if (jj_scan_token(NOT)) return true; - if (jj_3R_73()) return true; + private boolean jj_3R_54() { + if (jj_scan_token(KEY)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_77()) { + if (jj_3R_110()) { jj_scanpos = xsp; - if (jj_3R_78()) return true; + if (jj_3R_111()) return true; } return false; } - private boolean jj_3R_76() { - if (jj_3R_25()) return true; + private boolean jj_3_60() { + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_27() { - if (jj_3R_59()) return true; + private boolean jj_3R_29() { + if (jj_3R_67()) return true; if (jj_scan_token(LPAREN)) return true; Token xsp; xsp = jj_scanpos; if (jj_scan_token(77)) { jj_scanpos = xsp; - if (jj_3R_60()) return true; + if (jj_3R_68()) return true; } if (jj_scan_token(RPAREN)) return true; return false; } - private boolean jj_3R_75() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_22()) return true; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - private boolean jj_3R_74() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_72()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_111()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(RBRACKET)) return true; + private boolean jj_3R_55() { + if (jj_3R_56()) return true; + if (jj_scan_token(INSTANCEOF)) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_38() { - if (jj_3R_72()) return true; - if (jj_3R_73()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_74()) { - jj_scanpos = xsp; - if (jj_3R_75()) { - jj_scanpos = xsp; - if (jj_3R_76()) return true; - } - } + private boolean jj_3R_108() { + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_102() { + private boolean jj_3R_128() { if (jj_scan_token(RECORD_ATTRIBUTE)) return true; return false; } - private boolean jj_3_27() { - if (jj_3R_26()) return true; + private boolean jj_3_59() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_32()) return true; + if (jj_scan_token(RPAREN)) return true; return false; } - private boolean jj_3R_159() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_72()) return true; + private boolean jj_3_27() { + if (jj_3R_28()) return true; return false; } - private boolean jj_3R_205() { - if (jj_3R_59()) return true; + private boolean jj_3R_216() { + if (jj_3R_67()) return true; return false; } private boolean jj_3_26() { - if (jj_3R_25()) return true; - return false; - } - - private boolean jj_3R_73() { - if (jj_scan_token(IN)) return true; + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_81() { - if (jj_3R_72()) return true; + private boolean jj_3R_50() { + if (jj_3R_56()) return true; + if (jj_3R_107()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3_59()) { + jj_scanpos = xsp; + if (jj_3R_108()) return true; + } return false; } - private boolean jj_3R_80() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_30()) return true; - if (jj_scan_token(RPAREN)) return true; + private boolean jj_3R_47() { + if (jj_3R_56()) return true; + if (jj_3R_105()) return true; + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_160() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_72()) return true; + private boolean jj_3R_179() { + if (jj_scan_token(EQ)) return true; return false; } private boolean jj_3_24() { - if (jj_3R_26()) return true; + if (jj_3R_28()) return true; return false; } - private boolean jj_3R_71() { - if (jj_3R_26()) return true; + private boolean jj_3R_79() { + if (jj_3R_28()) return true; return false; } - private boolean jj_3R_42() { - if (jj_3R_72()) return true; - if (jj_scan_token(CONTAINS)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_80()) { - jj_scanpos = xsp; - if (jj_3R_81()) return true; - } + private boolean jj_3_23() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3_23() { - if (jj_3R_25()) return true; + private boolean jj_3R_78() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_70() { - if (jj_3R_25()) return true; + private boolean jj_3R_107() { + if (jj_scan_token(CONTAINSVALUE)) return true; return false; } - private boolean jj_3R_122() { - if (jj_3R_72()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_159()) { jj_scanpos = xsp; break; } - } + private boolean jj_3_25() { + if (jj_3R_26()) return true; return false; } - private boolean jj_3_25() { - if (jj_3R_24()) return true; + private boolean jj_3R_75() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_74()) return true; return false; } - private boolean jj_3R_36() { - if (jj_3R_72()) return true; - if (jj_scan_token(IS)) return true; - if (jj_scan_token(NOT)) return true; - if (jj_scan_token(DEFINED)) return true; + private boolean jj_3R_77() { + if (jj_3R_28()) return true; return false; } - private boolean jj_3R_67() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_66()) return true; + private boolean jj_3R_187() { + if (jj_scan_token(CONTAINSKEY)) return true; return false; } - private boolean jj_3R_123() { - if (jj_3R_72()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_160()) { jj_scanpos = xsp; break; } - } + private boolean jj_3R_76() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_69() { + private boolean jj_3_22() { if (jj_3R_26()) return true; return false; } - private boolean jj_3R_37() { - if (jj_3R_72()) return true; - if (jj_scan_token(IS)) return true; - if (jj_scan_token(DEFINED)) return true; - return false; - } - - private boolean jj_3R_68() { - if (jj_3R_25()) return true; - return false; - } - - private boolean jj_3_22() { - if (jj_3R_24()) return true; + private boolean jj_3R_186() { + if (jj_scan_token(LIKE)) return true; return false; } private boolean jj_3R_34() { - if (jj_3R_72()) return true; - if (jj_scan_token(IS)) return true; - if (jj_scan_token(NOT)) return true; - if (jj_scan_token(NULL)) return true; - return false; - } - - private boolean jj_3R_32() { Token xsp; xsp = jj_scanpos; if (jj_3_22()) { jj_scanpos = xsp; - if (jj_3R_68()) { + if (jj_3R_76()) { jj_scanpos = xsp; - if (jj_3R_69()) return true; + if (jj_3R_77()) return true; } } if (jj_scan_token(MINUS)) return true; xsp = jj_scanpos; if (jj_3_25()) { jj_scanpos = xsp; - if (jj_3R_70()) { + if (jj_3R_78()) { jj_scanpos = xsp; - if (jj_3R_71()) return true; + if (jj_3R_79()) return true; } } return false; } private boolean jj_3_20() { - if (jj_3R_25()) return true; + if (jj_3R_27()) return true; return false; } - private boolean jj_3_21() { - if (jj_3R_26()) return true; + private boolean jj_3R_185() { + if (jj_scan_token(LE)) return true; return false; } - private boolean jj_3R_35() { - if (jj_3R_72()) return true; - if (jj_scan_token(IS)) return true; - if (jj_scan_token(NULL)) return true; + private boolean jj_3_21() { + if (jj_3R_28()) return true; return false; } - private boolean jj_3R_31() { - if (jj_3R_66()) return true; + private boolean jj_3R_33() { + if (jj_3R_74()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_67()) { jj_scanpos = xsp; break; } + if (jj_3R_75()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_41() { - if (jj_3R_72()) return true; - if (jj_scan_token(BETWEEN)) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(AND)) return true; - if (jj_3R_72()) return true; - return false; - } - - private boolean jj_3R_106() { - if (jj_3R_25()) return true; + private boolean jj_3R_184() { + if (jj_scan_token(GE)) return true; return false; } - private boolean jj_3R_87() { - if (jj_scan_token(BETWEEN)) return true; - if (jj_scan_token(LBRACKET)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_123()) jj_scanpos = xsp; - if (jj_scan_token(RBRACKET)) return true; - if (jj_scan_token(AND)) return true; - if (jj_scan_token(LBRACKET)) return true; - xsp = jj_scanpos; - if (jj_3R_124()) jj_scanpos = xsp; - if (jj_scan_token(RBRACKET)) return true; + private boolean jj_3R_132() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_107() { - if (jj_3R_26()) return true; + private boolean jj_3R_133() { + if (jj_3R_28()) return true; return false; } - private boolean jj_3R_105() { - if (jj_3R_23()) return true; + private boolean jj_3R_183() { + if (jj_scan_token(NEQ)) return true; return false; } - private boolean jj_3R_86() { - if (jj_3R_79()) return true; - if (jj_scan_token(LBRACKET)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_122()) jj_scanpos = xsp; - if (jj_scan_token(RBRACKET)) return true; + private boolean jj_3R_131() { + if (jj_3R_25()) return true; return false; } - private boolean jj_3R_47() { - if (jj_scan_token(KEY)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_86()) { - jj_scanpos = xsp; - if (jj_3R_87()) return true; - } + private boolean jj_3R_182() { + if (jj_scan_token(NE)) return true; return false; } private boolean jj_3_17() { - if (jj_3R_25()) return true; + if (jj_3R_27()) return true; return false; } private boolean jj_3_18() { - if (jj_3R_26()) return true; + if (jj_3R_28()) return true; return false; } private boolean jj_3_19() { - if (jj_3R_24()) return true; + if (jj_3R_26()) return true; return false; } - private boolean jj_3R_66() { + private boolean jj_3R_74() { Token xsp; xsp = jj_scanpos; if (jj_3_19()) { @@ -4712,11 +4795,11 @@ private boolean jj_3R_66() { jj_scanpos = xsp; if (jj_scan_token(48)) { jj_scanpos = xsp; - if (jj_3R_105()) { + if (jj_3R_131()) { jj_scanpos = xsp; - if (jj_3R_106()) { + if (jj_3R_132()) { jj_scanpos = xsp; - if (jj_3R_107()) return true; + if (jj_3R_133()) return true; } } } @@ -4726,75 +4809,133 @@ private boolean jj_3R_66() { return false; } - private boolean jj_3R_48() { - if (jj_3R_72()) return true; - if (jj_scan_token(INSTANCEOF)) return true; - if (jj_3R_59()) return true; + private boolean jj_3_43() { + if (jj_3R_40()) return true; return false; } - private boolean jj_3R_109() { - if (jj_3R_25()) return true; + private boolean jj_3R_181() { + if (jj_scan_token(GT)) return true; return false; } - private boolean jj_3R_84() { - if (jj_3R_72()) return true; + private boolean jj_3R_180() { + if (jj_scan_token(LT)) return true; return false; } - private boolean jj_3R_110() { - if (jj_3R_26()) return true; + private boolean jj_3R_113() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_108() { - if (jj_3R_23()) return true; + private boolean jj_3R_114() { + if (jj_3R_28()) return true; return false; } - private boolean jj_3R_83() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_30()) return true; - if (jj_scan_token(RPAREN)) return true; + private boolean jj_3R_177() { + if (jj_3R_40()) return true; return false; } - private boolean jj_3_15() { - if (jj_3R_27()) return true; + private boolean jj_3R_112() { + if (jj_3R_25()) return true; return false; } - private boolean jj_3R_43() { - if (jj_3R_72()) return true; - if (jj_3R_82()) return true; + private boolean jj_3R_149() { + if (jj_3R_187()) return true; + return false; + } + + private boolean jj_3R_141() { + if (jj_3R_179()) return true; + return false; + } + + private boolean jj_3R_105() { Token xsp; xsp = jj_scanpos; - if (jj_3R_83()) { + if (jj_3R_141()) { + jj_scanpos = xsp; + if (jj_3R_142()) { + jj_scanpos = xsp; + if (jj_3R_143()) { + jj_scanpos = xsp; + if (jj_3R_144()) { jj_scanpos = xsp; - if (jj_3R_84()) return true; + if (jj_3R_145()) { + jj_scanpos = xsp; + if (jj_3R_146()) { + jj_scanpos = xsp; + if (jj_3R_147()) { + jj_scanpos = xsp; + if (jj_3R_148()) { + jj_scanpos = xsp; + if (jj_3R_149()) return true; + } + } + } + } + } + } + } } return false; } - private boolean jj_3R_40() { - if (jj_3R_72()) return true; - if (jj_3R_79()) return true; - if (jj_3R_72()) return true; + private boolean jj_3R_148() { + if (jj_3R_186()) return true; + return false; + } + + private boolean jj_3R_147() { + if (jj_3R_185()) return true; + return false; + } + + private boolean jj_3_15() { + if (jj_3R_29()) return true; + return false; + } + + private boolean jj_3R_146() { + if (jj_3R_184()) return true; + return false; + } + + private boolean jj_3R_145() { + if (jj_3R_183()) return true; + return false; + } + + private boolean jj_3R_144() { + if (jj_3R_182()) return true; return false; } private boolean jj_3_16() { - if (jj_3R_24()) return true; + if (jj_3R_26()) return true; return false; } private boolean jj_3_14() { - if (jj_3R_25()) return true; + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_72() { + private boolean jj_3R_143() { + if (jj_3R_181()) return true; + return false; + } + + private boolean jj_3R_142() { + if (jj_3R_180()) return true; + return false; + } + + private boolean jj_3R_56() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(20)) { @@ -4807,11 +4948,11 @@ private boolean jj_3R_72() { jj_scanpos = xsp; if (jj_scan_token(48)) { jj_scanpos = xsp; - if (jj_3R_108()) { + if (jj_3R_112()) { jj_scanpos = xsp; - if (jj_3R_109()) { + if (jj_3R_113()) { jj_scanpos = xsp; - if (jj_3R_110()) return true; + if (jj_3R_114()) return true; } } } @@ -4822,233 +4963,179 @@ private boolean jj_3R_72() { return false; } - private boolean jj_3R_150() { - if (jj_scan_token(EQ)) return true; + private boolean jj_3_57() { + if (jj_3R_54()) return true; return false; } - private boolean jj_3R_189() { - if (jj_3R_99()) return true; + private boolean jj_3_58() { + if (jj_3R_55()) return true; return false; } - private boolean jj_3R_188() { - if (jj_3R_27()) return true; + private boolean jj_3_56() { + if (jj_3R_53()) return true; return false; } - private boolean jj_3R_187() { - if (jj_3R_25()) return true; + private boolean jj_3R_215() { + if (jj_3R_36()) return true; return false; } - private boolean jj_3_12() { - if (jj_3R_26()) return true; + private boolean jj_3R_214() { + if (jj_3R_29()) return true; return false; } - private boolean jj_3R_82() { - if (jj_scan_token(CONTAINSVALUE)) return true; + private boolean jj_3R_213() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3_13() { - if (jj_scan_token(STRING_LITERAL)) return true; + private boolean jj_3_12() { + if (jj_3R_28()) return true; return false; } - private boolean jj_3_11() { - if (jj_3R_25()) return true; + private boolean jj_3_54() { + if (jj_3R_51()) return true; return false; } - private boolean jj_3R_158() { - if (jj_scan_token(CONTAINSKEY)) return true; + private boolean jj_3_55() { + if (jj_3R_52()) return true; return false; } - private boolean jj_3R_178() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_13()) { - jj_scanpos = xsp; - if (jj_3R_187()) { - jj_scanpos = xsp; - if (jj_3R_188()) return true; - } - } - xsp = jj_scanpos; - if (jj_3R_189()) jj_scanpos = xsp; + private boolean jj_3_13() { + if (jj_scan_token(STRING_LITERAL)) return true; return false; } - private boolean jj_3R_177() { - if (jj_3R_24()) return true; + private boolean jj_3_11() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_183() { - if (jj_3R_26()) return true; + private boolean jj_3R_97() { + if (jj_3R_54()) return true; return false; } - private boolean jj_3R_157() { - if (jj_scan_token(LIKE)) return true; + private boolean jj_3_53() { + if (jj_3R_50()) return true; return false; } - private boolean jj_3R_182() { - if (jj_3R_25()) return true; + private boolean jj_3R_98() { + if (jj_3R_55()) return true; return false; } - private boolean jj_3R_184() { - if (jj_scan_token(AS)) return true; - if (jj_3R_205()) return true; + private boolean jj_3R_96() { + if (jj_3R_53()) return true; return false; } - private boolean jj_3R_156() { - if (jj_scan_token(LE)) return true; + private boolean jj_3_52() { + if (jj_3R_49()) return true; return false; } - private boolean jj_3R_146() { + private boolean jj_3R_206() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(20)) { - jj_scanpos = xsp; - if (jj_scan_token(43)) { - jj_scanpos = xsp; - if (jj_scan_token(48)) { + if (jj_3_13()) { jj_scanpos = xsp; - if (jj_3R_177()) { + if (jj_3R_213()) { jj_scanpos = xsp; - if (jj_3R_178()) return true; - } - } + if (jj_3R_214()) return true; } } + xsp = jj_scanpos; + if (jj_3R_215()) jj_scanpos = xsp; return false; } - private boolean jj_3_10() { - if (jj_scan_token(STRING_LITERAL)) return true; + private boolean jj_3R_205() { + if (jj_3R_26()) return true; return false; } - private boolean jj_3R_181() { - if (jj_3R_24()) return true; + private boolean jj_3_51() { + if (jj_3R_48()) return true; return false; } - private boolean jj_3R_126() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_125()) return true; + private boolean jj_3R_210() { + if (jj_3R_28()) return true; return false; } - private boolean jj_3R_155() { - if (jj_scan_token(GE)) return true; + private boolean jj_3R_94() { + if (jj_3R_51()) return true; return false; } - private boolean jj_3R_154() { - if (jj_scan_token(NEQ)) return true; + private boolean jj_3_50() { + if (jj_3R_47()) return true; return false; } - private boolean jj_3R_153() { - if (jj_scan_token(NE)) return true; + private boolean jj_3R_95() { + if (jj_3R_52()) return true; return false; } - private boolean jj_3R_152() { - if (jj_scan_token(GT)) return true; + private boolean jj_3R_209() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_162() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(20)) { - jj_scanpos = xsp; - if (jj_3R_181()) { - jj_scanpos = xsp; - if (jj_3_10()) { - jj_scanpos = xsp; - if (jj_scan_token(43)) { - jj_scanpos = xsp; - if (jj_scan_token(48)) { - jj_scanpos = xsp; - if (jj_3R_182()) { - jj_scanpos = xsp; - if (jj_3R_183()) return true; - } - } - } - } - } - } - xsp = jj_scanpos; - if (jj_3R_184()) jj_scanpos = xsp; + private boolean jj_3R_211() { + if (jj_scan_token(AS)) return true; + if (jj_3R_216()) return true; return false; } - private boolean jj_3R_88() { - if (jj_3R_125()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_126()) { jj_scanpos = xsp; break; } - } + private boolean jj_3R_93() { + if (jj_3R_50()) return true; return false; } - private boolean jj_3R_125() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(77)) { - jj_scanpos = xsp; - if (jj_3R_162()) return true; - } + private boolean jj_3_42() { + if (jj_3R_39()) return true; return false; } - private boolean jj_3R_151() { - if (jj_scan_token(LT)) return true; + private boolean jj_3R_92() { + if (jj_3R_49()) return true; return false; } - private boolean jj_3R_121() { - if (jj_3R_158()) return true; + private boolean jj_3_48() { + if (jj_3R_45()) return true; return false; } - private boolean jj_3R_79() { + private boolean jj_3_49() { + if (jj_3R_46()) return true; + return false; + } + + private boolean jj_3R_174() { Token xsp; xsp = jj_scanpos; - if (jj_3R_113()) { - jj_scanpos = xsp; - if (jj_3R_114()) { - jj_scanpos = xsp; - if (jj_3R_115()) { - jj_scanpos = xsp; - if (jj_3R_116()) { - jj_scanpos = xsp; - if (jj_3R_117()) { + if (jj_scan_token(20)) { jj_scanpos = xsp; - if (jj_3R_118()) { + if (jj_scan_token(43)) { jj_scanpos = xsp; - if (jj_3R_119()) { + if (jj_scan_token(48)) { jj_scanpos = xsp; - if (jj_3R_120()) { + if (jj_3R_205()) { jj_scanpos = xsp; - if (jj_3R_121()) return true; - } - } - } - } + if (jj_3R_206()) return true; } } } @@ -5056,292 +5143,422 @@ private boolean jj_3R_79() { return false; } - private boolean jj_3R_113() { - if (jj_3R_150()) return true; + private boolean jj_3_10() { + if (jj_scan_token(STRING_LITERAL)) return true; return false; } - private boolean jj_3R_120() { - if (jj_3R_157()) return true; + private boolean jj_3R_91() { + if (jj_3R_48()) return true; return false; } - private boolean jj_3R_119() { - if (jj_3R_156()) return true; + private boolean jj_3_47() { + if (jj_3R_44()) return true; return false; } - private boolean jj_3R_96() { - if (jj_scan_token(COLON)) return true; - if (jj_3R_59()) return true; + private boolean jj_3R_208() { + if (jj_3R_26()) return true; return false; } - private boolean jj_3R_118() { - if (jj_3R_155()) return true; + private boolean jj_3R_154() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_153()) return true; return false; } - private boolean jj_3R_117() { - if (jj_3R_154()) return true; + private boolean jj_3R_90() { + if (jj_3R_47()) return true; return false; } - private boolean jj_3R_116() { - if (jj_3R_153()) return true; + private boolean jj_3_46() { + if (jj_3R_43()) return true; return false; } - private boolean jj_3R_115() { - if (jj_3R_152()) return true; + private boolean jj_3R_176() { + if (jj_3R_39()) return true; return false; } - private boolean jj_3R_114() { - if (jj_3R_151()) return true; + private boolean jj_3_45() { + if (jj_3R_42()) return true; return false; } - private boolean jj_3R_95() { - if (jj_scan_token(HOOK)) return true; + private boolean jj_3R_88() { + if (jj_3R_45()) return true; return false; } - private boolean jj_3_49() { - if (jj_3R_47()) return true; + private boolean jj_3_44() { + if (jj_3R_41()) return true; return false; } - private boolean jj_3_50() { - if (jj_3R_48()) return true; + private boolean jj_3R_89() { + if (jj_3R_46()) return true; return false; } - private boolean jj_3_48() { - if (jj_3R_46()) return true; + private boolean jj_3R_87() { + if (jj_3R_44()) return true; return false; } - private boolean jj_3R_56() { - if (jj_3R_96()) return true; + private boolean jj_3R_86() { + if (jj_3R_43()) return true; return false; } - private boolean jj_3R_25() { + private boolean jj_3R_85() { + if (jj_3R_42()) return true; + return false; + } + + private boolean jj_3R_39() { Token xsp; xsp = jj_scanpos; - if (jj_3R_55()) { + if (jj_3R_84()) { jj_scanpos = xsp; - if (jj_3R_56()) return true; + if (jj_3R_85()) { + jj_scanpos = xsp; + if (jj_3R_86()) { + jj_scanpos = xsp; + if (jj_3R_87()) { + jj_scanpos = xsp; + if (jj_3R_88()) { + jj_scanpos = xsp; + if (jj_3R_89()) { + jj_scanpos = xsp; + if (jj_3R_90()) { + jj_scanpos = xsp; + if (jj_3R_91()) { + jj_scanpos = xsp; + if (jj_3R_92()) { + jj_scanpos = xsp; + if (jj_3R_93()) { + jj_scanpos = xsp; + if (jj_3R_94()) { + jj_scanpos = xsp; + if (jj_3R_95()) { + jj_scanpos = xsp; + if (jj_3R_96()) { + jj_scanpos = xsp; + if (jj_3R_97()) { + jj_scanpos = xsp; + if (jj_3R_98()) return true; + } + } + } + } + } + } + } + } + } + } + } + } + } } return false; } - private boolean jj_3R_55() { - if (jj_3R_95()) return true; + private boolean jj_3R_84() { + if (jj_3R_41()) return true; return false; } - private boolean jj_3_9() { - if (jj_3R_23()) return true; + private boolean jj_3R_191() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(20)) { + jj_scanpos = xsp; + if (jj_3R_208()) { + jj_scanpos = xsp; + if (jj_3_10()) { + jj_scanpos = xsp; + if (jj_scan_token(43)) { + jj_scanpos = xsp; + if (jj_scan_token(48)) { + jj_scanpos = xsp; + if (jj_3R_209()) { + jj_scanpos = xsp; + if (jj_3R_210()) return true; + } + } + } + } + } + } + xsp = jj_scanpos; + if (jj_3R_211()) jj_scanpos = xsp; return false; } - private boolean jj_3_46() { - if (jj_3R_44()) return true; + private boolean jj_3R_130() { + if (jj_scan_token(AND)) return true; + if (jj_3R_129()) return true; return false; } - private boolean jj_3_47() { - if (jj_3R_45()) return true; + private boolean jj_3R_115() { + if (jj_3R_153()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_154()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_203() { - if (jj_3R_47()) return true; + private boolean jj_3R_153() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(77)) { + jj_scanpos = xsp; + if (jj_3R_191()) return true; + } return false; } - private boolean jj_3R_204() { - if (jj_3R_48()) return true; + private boolean jj_3R_40() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_32()) return true; + if (jj_scan_token(RPAREN)) return true; return false; } - private boolean jj_3_45() { - if (jj_3R_43()) return true; + private boolean jj_3_41() { + if (jj_scan_token(NOT)) return true; return false; } - private boolean jj_3R_202() { - if (jj_3R_46()) return true; + private boolean jj_3R_73() { + if (jj_scan_token(OR)) return true; + if (jj_3R_72()) return true; return false; } - private boolean jj_3_44() { - if (jj_3R_42()) return true; + private boolean jj_3R_129() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_41()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_176()) { + jj_scanpos = xsp; + if (jj_3R_177()) return true; + } return false; } - private boolean jj_3_43() { - if (jj_3R_41()) return true; + private boolean jj_3R_123() { + if (jj_scan_token(COLON)) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_200() { - if (jj_3R_44()) return true; - return false; + private boolean jj_3R_72() { + if (jj_3R_129()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_130()) { jj_scanpos = xsp; break; } + } + return false; } - private boolean jj_3R_201() { - if (jj_3R_45()) return true; + private boolean jj_3R_122() { + if (jj_scan_token(HOOK)) return true; return false; } - private boolean jj_3_42() { - if (jj_3R_40()) return true; + private boolean jj_3R_32() { + if (jj_3R_72()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_73()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_199() { - if (jj_3R_43()) return true; + private boolean jj_3R_64() { + if (jj_3R_123()) return true; return false; } - private boolean jj_3_8() { - if (jj_3R_24()) return true; + private boolean jj_3R_27() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_63()) { + jj_scanpos = xsp; + if (jj_3R_64()) return true; + } return false; } - private boolean jj_3R_198() { - if (jj_3R_42()) return true; + private boolean jj_3R_63() { + if (jj_3R_122()) return true; return false; } - private boolean jj_3_40() { - if (jj_3R_38()) return true; + private boolean jj_3R_197() { + if (jj_3R_212()) return true; return false; } - private boolean jj_3_41() { - if (jj_3R_39()) return true; + private boolean jj_3R_117() { + if (jj_3R_32()) return true; return false; } - private boolean jj_3R_197() { - if (jj_3R_41()) return true; + private boolean jj_3_9() { + if (jj_3R_25()) return true; return false; } - private boolean jj_3_39() { - if (jj_3R_37()) return true; + private boolean jj_3R_194() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(110)) { + jj_scanpos = xsp; + if (jj_scan_token(111)) { + jj_scanpos = xsp; + if (jj_scan_token(112)) { + jj_scanpos = xsp; + if (jj_scan_token(113)) return true; + } + } + } return false; } - private boolean jj_3R_149() { - if (jj_3R_180()) return true; + private boolean jj_3_8() { + if (jj_3R_26()) return true; + return false; + } + + private boolean jj_3R_195() { + if (jj_scan_token(METADATA_IDENTIFIER)) return true; return false; } private boolean jj_3R_196() { - if (jj_3R_40()) return true; + if (jj_3R_24()) return true; return false; } - private boolean jj_3_38() { - if (jj_3R_36()) return true; + private boolean jj_3R_192() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_25()) return true; return false; } - private boolean jj_3_37() { - if (jj_3R_35()) return true; + private boolean jj_3R_193() { + if (jj_scan_token(CLUSTER_IDENTIFIER)) return true; return false; } - private boolean jj_3R_194() { - if (jj_3R_38()) return true; + private boolean jj_3R_161() { + if (jj_scan_token(LPAREN)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_196()) { + jj_scanpos = xsp; + if (jj_3R_197()) return true; + } + if (jj_scan_token(RPAREN)) return true; return false; } - private boolean jj_3R_195() { - if (jj_3R_39()) return true; + private boolean jj_3_6() { + if (jj_3R_25()) return true; return false; } - private boolean jj_3_36() { - if (jj_3R_34()) return true; + private boolean jj_3R_160() { + if (jj_3R_67()) return true; return false; } - private boolean jj_3_6() { - if (jj_3R_23()) return true; + private boolean jj_3R_158() { + if (jj_3R_194()) return true; return false; } - private boolean jj_3R_193() { - if (jj_3R_37()) return true; + private boolean jj_3R_164() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(30)) { + jj_scanpos = xsp; + if (jj_scan_token(28)) return true; + } return false; } - private boolean jj_3R_192() { - if (jj_3R_36()) return true; + private boolean jj_3_7() { + if (jj_3R_26()) return true; return false; } - private boolean jj_3R_191() { - if (jj_3R_35()) return true; + private boolean jj_3R_159() { + if (jj_3R_195()) return true; return false; } - private boolean jj_3_7() { - if (jj_3R_24()) return true; + private boolean jj_3R_157() { + if (jj_3R_193()) return true; return false; } - private boolean jj_3R_190() { - if (jj_3R_34()) return true; + private boolean jj_3R_156() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_3R_25()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_192()) { jj_scanpos = xsp; break; } + } + if (jj_scan_token(RBRACKET)) return true; return false; } - private boolean jj_3R_179() { + private boolean jj_3R_200() { Token xsp; xsp = jj_scanpos; - if (jj_3R_190()) { - jj_scanpos = xsp; - if (jj_3R_191()) { - jj_scanpos = xsp; - if (jj_3R_192()) { - jj_scanpos = xsp; - if (jj_3R_193()) { - jj_scanpos = xsp; - if (jj_3R_194()) { - jj_scanpos = xsp; - if (jj_3R_195()) { - jj_scanpos = xsp; - if (jj_3R_196()) { - jj_scanpos = xsp; - if (jj_3R_197()) { + if (jj_scan_token(30)) { jj_scanpos = xsp; - if (jj_3R_198()) { + if (jj_scan_token(28)) return true; + } + return false; + } + + private boolean jj_3R_155() { + if (jj_3R_25()) return true; + return false; + } + + private boolean jj_3R_116() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_155()) { jj_scanpos = xsp; - if (jj_3R_199()) { + if (jj_3R_156()) { jj_scanpos = xsp; - if (jj_3R_200()) { + if (jj_3R_157()) { jj_scanpos = xsp; - if (jj_3R_201()) { + if (jj_3R_158()) { jj_scanpos = xsp; - if (jj_3R_202()) { + if (jj_3R_159()) { jj_scanpos = xsp; - if (jj_3R_203()) { + if (jj_3R_160()) { jj_scanpos = xsp; - if (jj_3R_204()) return true; - } - } - } - } - } - } - } - } + if (jj_3R_161()) return true; } } } @@ -5351,405 +5568,548 @@ private boolean jj_3R_179() { return false; } - private boolean jj_3R_148() { - if (jj_3R_179()) return true; + private boolean jj_3_40() { + if (jj_3R_36()) return true; return false; } - private boolean jj_3R_104() { - if (jj_scan_token(AND)) return true; - if (jj_3R_103()) return true; + private boolean jj_3R_58() { + if (jj_3R_116()) return true; return false; } - private boolean jj_3R_180() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_30()) return true; - if (jj_scan_token(RPAREN)) return true; + private boolean jj_3R_175() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_174()) return true; return false; } - private boolean jj_3R_65() { - if (jj_scan_token(OR)) return true; - if (jj_3R_64()) return true; + private boolean jj_3_4() { + if (jj_3R_25()) return true; return false; } - private boolean jj_3_4() { - if (jj_3R_23()) return true; + private boolean jj_3R_83() { + if (jj_3R_36()) return true; return false; } - private boolean jj_3R_103() { + private boolean jj_3_5() { + if (jj_3R_26()) return true; + return false; + } + + private boolean jj_3R_109() { + if (jj_3R_28()) return true; + return false; + } + + private boolean jj_3R_166() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_67()) return true; + return false; + } + + private boolean jj_3R_163() { + if (jj_3R_25()) return true; + return false; + } + + private boolean jj_3R_199() { + if (jj_3R_25()) return true; + return false; + } + + private boolean jj_3R_38() { + if (jj_3R_82()) return true; Token xsp; xsp = jj_scanpos; - if (jj_scan_token(96)) jj_scanpos = xsp; + if (jj_3R_83()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_172() { + Token xsp; xsp = jj_scanpos; - if (jj_3R_148()) { + if (jj_scan_token(77)) { jj_scanpos = xsp; - if (jj_3R_149()) return true; + if (jj_scan_token(78)) return true; } + if (jj_3R_171()) return true; return false; } - private boolean jj_3R_64() { - if (jj_3R_103()) return true; + private boolean jj_3R_127() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_3R_174()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_104()) { jj_scanpos = xsp; break; } + if (jj_3R_175()) { jj_scanpos = xsp; break; } } + if (jj_scan_token(RBRACKET)) return true; return false; } - private boolean jj_3_5() { - if (jj_3R_24()) return true; + private boolean jj_3R_202() { + if (jj_scan_token(OFFSET)) return true; + if (jj_3R_26()) return true; return false; } - private boolean jj_3R_30() { - if (jj_3R_64()) return true; + private boolean jj_3R_201() { + if (jj_scan_token(SKIP2)) return true; + if (jj_3R_26()) return true; + return false; + } + + private boolean jj_3R_167() { Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_65()) { jj_scanpos = xsp; break; } + xsp = jj_scanpos; + if (jj_3R_201()) { + jj_scanpos = xsp; + if (jj_3R_202()) return true; } return false; } - private boolean jj_3R_168() { - if (jj_3R_185()) return true; + private boolean jj_3_39() { + if (jj_3R_38()) return true; return false; } - private boolean jj_3R_90() { - if (jj_3R_30()) return true; + private boolean jj_3R_37() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_66()) return true; + if (jj_scan_token(RPAREN)) return true; return false; } - private boolean jj_3R_165() { + private boolean jj_3R_162() { + if (jj_3R_67()) return true; + return false; + } + + private boolean jj_3R_125() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(110)) { - jj_scanpos = xsp; - if (jj_scan_token(111)) { + if (jj_scan_token(75)) { jj_scanpos = xsp; - if (jj_scan_token(112)) { - jj_scanpos = xsp; - if (jj_scan_token(113)) return true; - } - } + if (jj_scan_token(76)) return true; } + if (jj_3R_124()) return true; return false; } - private boolean jj_3R_166() { - if (jj_scan_token(METADATA_IDENTIFIER)) return true; + private boolean jj_3_38() { + if (jj_3R_37()) return true; return false; } - private boolean jj_3R_167() { - if (jj_3R_22()) return true; + private boolean jj_3R_190() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_56()) return true; + return false; + } + + private boolean jj_3R_169() { + if (jj_scan_token(LIMIT)) return true; + if (jj_3R_26()) return true; + return false; + } + + private boolean jj_3R_198() { + if (jj_3R_67()) return true; + return false; + } + + private boolean jj_3R_204() { + if (jj_3R_38()) return true; + return false; + } + + private boolean jj_3R_119() { + if (jj_scan_token(GROUP)) return true; + if (jj_scan_token(BY)) return true; + if (jj_3R_67()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_166()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_163() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_23()) return true; + private boolean jj_3R_203() { + if (jj_3R_37()) return true; return false; } - private boolean jj_3R_164() { - if (jj_scan_token(CLUSTER_IDENTIFIER)) return true; + private boolean jj_3R_171() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_203()) { + jj_scanpos = xsp; + if (jj_3R_204()) return true; + } return false; } - private boolean jj_3R_133() { - if (jj_scan_token(LPAREN)) return true; + private boolean jj_3R_165() { + if (jj_scan_token(COMMA)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_167()) { + if (jj_3R_198()) { + jj_scanpos = xsp; + if (jj_3R_199()) { jj_scanpos = xsp; - if (jj_3R_168()) return true; + if (jj_scan_token(32)) return true; } - if (jj_scan_token(RPAREN)) return true; + } + xsp = jj_scanpos; + if (jj_3R_200()) jj_scanpos = xsp; return false; } - private boolean jj_3R_132() { - if (jj_3R_59()) return true; + private boolean jj_3R_140() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_207() { - if (jj_scan_token(WHILE)) return true; - if (jj_3R_90()) return true; + private boolean jj_3R_118() { + if (jj_scan_token(ORDER)) return true; + if (jj_scan_token(BY)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_162()) { + jj_scanpos = xsp; + if (jj_3R_163()) { + jj_scanpos = xsp; + if (jj_scan_token(32)) return true; + } + } + xsp = jj_scanpos; + if (jj_3R_164()) jj_scanpos = xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_165()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_142() { - if (jj_3R_139()) return true; + private boolean jj_3R_152() { + if (jj_3R_56()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_190()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_130() { - if (jj_3R_165()) return true; + private boolean jj_3R_124() { + if (jj_3R_171()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_172()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_58() { - if (jj_3R_99()) return true; + private boolean jj_3R_66() { + if (jj_3R_124()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_125()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_131() { - if (jj_3R_166()) return true; + private boolean jj_3R_53() { + if (jj_3R_56()) return true; + if (jj_scan_token(MATCHES)) return true; + if (jj_scan_token(STRING_LITERAL)) return true; return false; } - private boolean jj_3R_129() { - if (jj_3R_164()) return true; + private boolean jj_3R_218() { + if (jj_scan_token(WHILE)) return true; + if (jj_3R_117()) return true; return false; } - private boolean jj_3R_206() { - if (jj_3R_88()) return true; + private boolean jj_3R_170() { + if (jj_3R_167()) return true; return false; } - private boolean jj_3R_140() { - if (jj_3R_141()) return true; + private boolean jj_3R_139() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_128() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_23()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_163()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(RBRACKET)) return true; + private boolean jj_3R_217() { + if (jj_3R_115()) return true; return false; } - private boolean jj_3R_136() { + private boolean jj_3R_52() { + if (jj_3R_56()) return true; + if (jj_scan_token(CONTAINSTEXT)) return true; Token xsp; xsp = jj_scanpos; - if (jj_scan_token(30)) { + if (jj_scan_token(49)) { jj_scanpos = xsp; - if (jj_scan_token(28)) return true; + if (jj_3R_109()) return true; } return false; } - private boolean jj_3R_185() { + private boolean jj_3R_168() { + if (jj_3R_169()) return true; + return false; + } + + private boolean jj_3R_212() { if (jj_scan_token(TRAVERSE)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_206()) jj_scanpos = xsp; + if (jj_3R_217()) jj_scanpos = xsp; if (jj_scan_token(FROM)) return true; - if (jj_3R_50()) return true; + if (jj_3R_58()) return true; xsp = jj_scanpos; - if (jj_3R_207()) jj_scanpos = xsp; + if (jj_3R_218()) jj_scanpos = xsp; return false; } - private boolean jj_3R_127() { - if (jj_3R_23()) return true; + private boolean jj_3R_65() { return false; } - private boolean jj_3R_89() { + private boolean jj_3R_51() { + if (jj_3R_56()) return true; + if (jj_scan_token(CONTAINSALL)) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_32()) return true; + if (jj_scan_token(RPAREN)) return true; + return false; + } + + private boolean jj_3R_121() { + if (jj_3R_169()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_127()) { - jj_scanpos = xsp; - if (jj_3R_128()) { - jj_scanpos = xsp; - if (jj_3R_129()) { - jj_scanpos = xsp; - if (jj_3R_130()) { - jj_scanpos = xsp; - if (jj_3R_131()) { - jj_scanpos = xsp; - if (jj_3R_132()) { - jj_scanpos = xsp; - if (jj_3R_133()) return true; - } - } - } - } - } - } + if (jj_3R_170()) jj_scanpos = xsp; return false; } - private boolean jj_3R_171() { + private boolean jj_3R_120() { + if (jj_3R_167()) return true; Token xsp; xsp = jj_scanpos; - if (jj_scan_token(30)) { - jj_scanpos = xsp; - if (jj_scan_token(28)) return true; - } + if (jj_3R_168()) jj_scanpos = xsp; return false; } - private boolean jj_3R_94() { - if (jj_3R_141()) return true; + private boolean jj_3R_62() { Token xsp; xsp = jj_scanpos; - if (jj_3R_142()) jj_scanpos = xsp; + if (jj_3R_120()) { + jj_scanpos = xsp; + if (jj_3R_121()) return true; + } return false; } - private boolean jj_3R_50() { - if (jj_3R_89()) return true; + private boolean jj_3_36() { + if (jj_3R_36()) return true; return false; } - private boolean jj_3R_54() { + private boolean jj_3R_103() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_3R_56()) return true; Token xsp; - xsp = jj_scanpos; - if (jj_3R_93()) { - jj_scanpos = xsp; - if (jj_3R_94()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_140()) { jj_scanpos = xsp; break; } } + if (jj_scan_token(RBRACKET)) return true; return false; } - private boolean jj_3R_93() { - if (jj_3R_139()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_140()) jj_scanpos = xsp; + private boolean jj_3R_104() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_24()) return true; + if (jj_scan_token(RPAREN)) return true; return false; } private boolean jj_3_33() { - if (jj_3R_32()) return true; + if (jj_3R_34()) return true; return false; } - private boolean jj_3R_147() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_146()) return true; + private boolean jj_3R_28() { + if (jj_3R_65()) return true; + if (jj_3R_66()) return true; return false; } - private boolean jj_3R_26() { - if (jj_3R_57()) return true; + private boolean jj_3_32() { + if (jj_3R_33()) return true; + return false; + } + + private boolean jj_3R_46() { + if (jj_3R_56()) return true; + if (jj_scan_token(NOT)) return true; + if (jj_3R_99()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_58()) jj_scanpos = xsp; + if (jj_3R_103()) { + jj_scanpos = xsp; + if (jj_3R_104()) return true; + } return false; } - private boolean jj_3_32() { - if (jj_3R_31()) return true; + private boolean jj_3R_61() { + if (jj_3R_119()) return true; return false; } - private boolean jj_3R_53() { - if (jj_3R_92()) return true; + private boolean jj_3R_60() { + if (jj_3R_118()) return true; return false; } - private boolean jj_3R_52() { - if (jj_3R_91()) return true; + private boolean jj_3_31() { + if (jj_3R_32()) return true; return false; } - private boolean jj_3_31() { - if (jj_3R_30()) return true; + private boolean jj_3R_102() { + if (jj_3R_27()) return true; return false; } - private boolean jj_3R_51() { + private boolean jj_3R_59() { if (jj_scan_token(WHERE)) return true; - if (jj_3R_90()) return true; + if (jj_3R_117()) return true; return false; } private boolean jj_3_35() { if (jj_scan_token(DOT)) return true; - if (jj_3R_29()) return true; + if (jj_3R_31()) return true; return false; } - private boolean jj_3R_22() { + private boolean jj_3R_81() { + if (jj_3R_36()) return true; + return false; + } + + private boolean jj_3R_101() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_24()) return true; + if (jj_scan_token(RPAREN)) return true; + return false; + } + + private boolean jj_3R_24() { if (jj_scan_token(SELECT)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_49()) jj_scanpos = xsp; + if (jj_3R_57()) jj_scanpos = xsp; if (jj_scan_token(FROM)) return true; - if (jj_3R_50()) return true; + if (jj_3R_58()) return true; xsp = jj_scanpos; - if (jj_3R_51()) jj_scanpos = xsp; + if (jj_3R_59()) jj_scanpos = xsp; xsp = jj_scanpos; - if (jj_3R_52()) jj_scanpos = xsp; + if (jj_3R_60()) jj_scanpos = xsp; xsp = jj_scanpos; - if (jj_3R_53()) jj_scanpos = xsp; + if (jj_3R_61()) jj_scanpos = xsp; xsp = jj_scanpos; - if (jj_3R_54()) jj_scanpos = xsp; + if (jj_3R_62()) jj_scanpos = xsp; return false; } - private boolean jj_3R_144() { - if (jj_3R_99()) return true; + private boolean jj_3R_57() { + if (jj_3R_115()) return true; return false; } - private boolean jj_3R_49() { - if (jj_3R_88()) return true; + private boolean jj_3_34() { + if (jj_3R_35()) return true; return false; } - private boolean jj_3_34() { - if (jj_3R_33()) return true; + private boolean jj_3R_100() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_3R_56()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_139()) { jj_scanpos = xsp; break; } + } + if (jj_scan_token(RBRACKET)) return true; return false; } - private boolean jj_3R_176() { - if (jj_3R_32()) return true; + private boolean jj_3R_136() { + if (jj_3R_34()) return true; return false; } - private boolean jj_3R_85() { - if (jj_3R_26()) return true; + private boolean jj_3R_135() { + if (jj_3R_33()) return true; return false; } - private boolean jj_3R_175() { - if (jj_3R_31()) return true; + private boolean jj_3_62() { + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_138() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_59()) return true; + private boolean jj_3R_45() { + if (jj_3R_56()) return true; + if (jj_3R_99()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_100()) { + jj_scanpos = xsp; + if (jj_3R_101()) { + jj_scanpos = xsp; + if (jj_3R_102()) return true; + } + } return false; } - private boolean jj_3R_174() { - if (jj_3R_30()) return true; + private boolean jj_3R_134() { + if (jj_3R_32()) return true; return false; } private boolean jj_3_3() { - if (jj_3R_22()) return true; + if (jj_3R_24()) return true; return false; } - private boolean jj_3R_208() { + private boolean jj_3R_207() { if (jj_scan_token(COMMA)) return true; - if (jj_3R_72()) return true; + if (jj_3R_56()) return true; return false; } - private boolean jj_3R_135() { - if (jj_3R_23()) return true; + private boolean jj_3_37() { + if (jj_scan_token(0)) return true; return false; } @@ -5764,7 +6124,7 @@ private boolean jj_3R_135() { private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[87]; + final private int[] jj_la1 = new int[85]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -5776,18 +6136,18 @@ private boolean jj_3R_135() { jj_la1_init_3(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x8c08000,0x0,0x3e0,0x20000000,0x0,0x20000000,0x88d08000,0x800,0x400000,0x800000,0x2000000,0xc000000,0xe000000,0xe000000,0x88d08000,0x1000,0x800,0x8c08000,0x0,0x800,0x0,0x100000,0x0,0x0,0x0,0x0,0x8c08000,0x0,0x100000,0x0,0x0,0x0,0x0,0x100000,0x0,0x20000000,0x88d08000,0x0,0x8d08000,0x100000,0x0,0x0,0x0,0x0,0x0,0x88d08000,0x0,0x0,0x88d08000,0x80000000,0x8c08000,0x0,0x0,0x0,0x0,0x60,0x8c08000,0x0,0x80000,0x40000,0x0,0x88d08000,0x0,0x88d08000,0x0,0x88d08000,0x0,0x88d08000,0x0,0x88d08000,0x0,0x88d08000,0x0,0x0,0x0,0x0,0x88c08000,0x8c08000,0x50000000,0x50000000,0x0,0x8c08000,0x50000000,0x50000000,0x0,0xc000000,0x0,}; + jj_la1_0 = new int[] {0x8c08000,0x0,0x3e0,0x20000000,0x0,0x20000000,0x88d08000,0x800,0x400000,0x800000,0x2000000,0xc000000,0xe000000,0xe000000,0x88d08000,0x1000,0x800,0x8c08000,0x0,0x800,0x0,0x100000,0x0,0x0,0x0,0x0,0x8c08000,0x0,0x100000,0x0,0x0,0x0,0x0,0x100000,0x0,0x20000000,0x88d08000,0x0,0x8d08000,0x100000,0x0,0x0,0x0,0x0,0x0,0x88d08000,0x0,0x0,0x88d08000,0x80000000,0x8c08000,0x0,0x0,0x0,0x0,0x0,0x0,0x60,0x8c08000,0x0,0x80000,0x40000,0x0,0x0,0x88d08000,0x0,0x88d08000,0x0,0x88d08000,0x0,0x0,0x0,0x0,0x0,0x88c08000,0x8c08000,0x50000000,0x50000000,0x0,0x8c08000,0x50000000,0x50000000,0x0,0xc000000,0x0,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x2000000,0x0,0x430881,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x430881,0x0,0x0,0x0,0x2000000,0x0,0x2000000,0x20000,0x410800,0x2000000,0x20000,0x410800,0x0,0x2000000,0x20000,0x800,0x410000,0x0,0x2000000,0x80,0x10800,0x0,0x430881,0x4400000,0x30880,0x0,0x30880,0x30880,0x2000000,0x4000000,0x2000000,0x430881,0x0,0x2000000,0x430881,0x400000,0x1,0x400000,0x4400000,0x4400000,0x2000000,0x0,0x440080,0x0,0x0,0x0,0x0,0x470881,0x70000000,0x470881,0x2000000,0x430881,0x2000000,0x430881,0x2000000,0x430881,0x70000000,0x470881,0x2000000,0x440000,0x2000000,0x440000,0x420001,0x81,0x0,0x0,0x2000000,0x81,0x0,0x0,0x2000000,0x0,0x2000000,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x2000000,0x0,0x470881,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x470881,0x0,0x0,0x0,0x2000000,0x0,0x2000000,0x20000,0x410800,0x2000000,0x20000,0x410800,0x0,0x2000000,0x20000,0x800,0x410000,0x0,0x2000000,0x80,0x10800,0x0,0x470881,0x4400000,0x30880,0x0,0x30880,0x30880,0x2000000,0x4000000,0x2000000,0x470881,0x0,0x2000000,0x470881,0x400000,0x1,0x400000,0x0,0x0,0x0,0x0,0x2000000,0x0,0x440080,0x0,0x0,0x0,0x70000000,0x2000000,0x470881,0x2000000,0x470881,0x2000000,0x470881,0x70000000,0x2000000,0x440000,0x2000000,0x440000,0x460001,0x81,0x0,0x0,0x2000000,0x81,0x0,0x0,0x2000000,0x0,0x2000000,}; } private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x1000,0x0,0x0,0x0,0x0,0x3006,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3006,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x1000,0x0,0x0,0x3006,0x0,0x1006,0x0,0x0,0x0,0x0,0x0,0x0,0x1006,0x2000,0x0,0x1006,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1006,0x78,0x1006,0x0,0x1006,0x0,0x1006,0x0,0x1006,0x78,0x1006,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_2 = new int[] {0x0,0x1000,0x0,0x0,0x0,0x0,0x3006,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3006,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x1000,0x0,0x0,0x3006,0x0,0x1006,0x0,0x0,0x0,0x0,0x0,0x0,0x1006,0x2000,0x0,0x1006,0x0,0x0,0x0,0x1800,0x1800,0x6000,0x6000,0x0,0x0,0x0,0x0,0x0,0x0,0x78,0x0,0x1006,0x0,0x1006,0x0,0x1006,0x78,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x2802,0x0,0x0,0x0,0x0,0x0,0x2802,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2802,0x0,0x0,0x7e802,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x42802,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2802,0x0,0x2802,0x0,0x400000,0x400000,0x0,0x0,0x0,0x402802,0x0,0x0,0x402802,0x0,0x2802,0x0,0x0,0x0,0x0,0x0,0x4fe802,0x3c000,0x0,0x0,0x1,0x402802,0x84,0x402802,0x0,0x402802,0x0,0x402802,0x0,0x402802,0x94,0x402802,0x0,0x0,0x0,0x0,0x2802,0x402802,0x0,0x0,0x0,0x402802,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_3 = new int[] {0x2802,0x0,0x0,0x0,0x0,0x0,0x2802,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2802,0x0,0x0,0x7e802,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x42802,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2802,0x0,0x2802,0x0,0x400000,0x400000,0x0,0x0,0x0,0x402802,0x0,0x0,0x402802,0x0,0x2802,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4fe802,0x3c000,0x0,0x0,0x84,0x0,0x402802,0x0,0x402802,0x0,0x402802,0x94,0x0,0x0,0x0,0x0,0x2802,0x402802,0x0,0x0,0x0,0x402802,0x0,0x0,0x0,0x0,0x0,}; } - final private JJCalls[] jj_2_rtns = new JJCalls[50]; + final private JJCalls[] jj_2_rtns = new JJCalls[62]; private boolean jj_rescan = false; private int jj_gc = 0; @@ -5802,7 +6162,7 @@ public OrientSql(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 87; i++) jj_la1[i] = -1; + for (int i = 0; i < 85; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5818,7 +6178,7 @@ public void ReInit(java.io.InputStream stream, String encoding) { jj_ntk = -1; jjtree.reset(); jj_gen = 0; - for (int i = 0; i < 87; i++) jj_la1[i] = -1; + for (int i = 0; i < 85; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5829,7 +6189,7 @@ public OrientSql(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 87; i++) jj_la1[i] = -1; + for (int i = 0; i < 85; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5841,7 +6201,7 @@ public void ReInit(java.io.Reader stream) { jj_ntk = -1; jjtree.reset(); jj_gen = 0; - for (int i = 0; i < 87; i++) jj_la1[i] = -1; + for (int i = 0; i < 85; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5851,7 +6211,7 @@ public OrientSql(OrientSqlTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 87; i++) jj_la1[i] = -1; + for (int i = 0; i < 85; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5862,7 +6222,7 @@ public void ReInit(OrientSqlTokenManager tm) { jj_ntk = -1; jjtree.reset(); jj_gen = 0; - for (int i = 0; i < 87; i++) jj_la1[i] = -1; + for (int i = 0; i < 85; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5979,7 +6339,7 @@ public ParseException generateParseException() { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 87; i++) { + for (int i = 0; i < 85; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<<j)) != 0) { @@ -6024,7 +6384,7 @@ final public void disable_tracing() { private void jj_rescan_token() { jj_rescan = true; - for (int i = 0; i < 50; i++) { + for (int i = 0; i < 62; i++) { try { JJCalls p = jj_2_rtns[i]; do { @@ -6081,6 +6441,18 @@ private void jj_rescan_token() { case 47: jj_3_48(); break; case 48: jj_3_49(); break; case 49: jj_3_50(); break; + case 50: jj_3_51(); break; + case 51: jj_3_52(); break; + case 52: jj_3_53(); break; + case 53: jj_3_54(); break; + case 54: jj_3_55(); break; + case 55: jj_3_56(); break; + case 56: jj_3_57(); break; + case 57: jj_3_58(); break; + case 58: jj_3_59(); break; + case 59: jj_3_60(); break; + case 60: jj_3_61(); break; + case 61: jj_3_62(); break; } } p = p.next; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlTreeConstants.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlTreeConstants.java index c33e5f6ed3a..5c8cff5e3b3 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlTreeConstants.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlTreeConstants.java @@ -36,50 +36,55 @@ public interface OrientSqlTreeConstants public int JJTSUFFIXIDENTIFIER = 30; public int JJTBASEIDENTIFIER = 31; public int JJTMODIFIER = 32; - public int JJTOPERATIONCHAIN = 33; - public int JJTFROMCLAUSE = 34; - public int JJTFROMITEM = 35; - public int JJTCLUSTER = 36; - public int JJTMETADATAIDENTIFIER = 37; - public int JJTINDEXIDENTIFIER = 38; - public int JJTWHERECLAUSE = 39; - public int JJTORBLOCK = 40; - public int JJTANDBLOCK = 41; - public int JJTNOTBLOCK = 42; - public int JJTPARENTHESISBLOCK = 43; - public int JJTCONDITIONBLOCK = 44; - public int JJTCOMPAREOPERATOR = 45; - public int JJTLTOPERATOR = 46; - public int JJTGTOPERATOR = 47; - public int JJTNEOPERATOR = 48; - public int JJTNEQOPERATOR = 49; - public int JJTGEOPERATOR = 50; - public int JJTLEOPERATOR = 51; - public int JJTLIKEOPERATOR = 52; - public int JJTCONTAINSKEYOPERATOR = 53; - public int JJTCONTAINSVALUEOPERATOR = 54; - public int JJTEQUALSCOMPAREOPERATOR = 55; - public int JJTBINARYCONDITION = 56; - public int JJTCONTAINSVALUECONDITION = 57; - public int JJTINSTANCEOFCONDITION = 58; - public int JJTINDEXMATCHCONDITION = 59; - public int JJTBETWEENCONDITION = 60; - public int JJTISNULLCONDITION = 61; - public int JJTISNOTNULLCONDITION = 62; - public int JJTISDEFINEDCONDITION = 63; - public int JJTISNOTDEFINEDCONDITION = 64; - public int JJTCONTAINSCONDITION = 65; - public int JJTINOPERATOR = 66; - public int JJTINCONDITION = 67; - public int JJTNOTINCONDITION = 68; - public int JJTCONTAINSALLCONDITION = 69; - public int JJTCONTAINSTEXTCONDITION = 70; - public int JJTMATCHESCONDITION = 71; - public int JJTORDERBY = 72; - public int JJTGROUPBY = 73; - public int JJTLIMIT = 74; - public int JJTSKIP = 75; - public int JJTITEMSCOLLECTION = 76; + public int JJTEXPRESSION = 33; + public int JJTADDEXPRESSION = 34; + public int JJTMULTEXPRESSION = 35; + public int JJTFIRSTLEVELEXPRESSION = 36; + public int JJTPARENTHESISEXPRESSION = 37; + public int JJTBASEEXPRESSION = 38; + public int JJTFROMCLAUSE = 39; + public int JJTFROMITEM = 40; + public int JJTCLUSTER = 41; + public int JJTMETADATAIDENTIFIER = 42; + public int JJTINDEXIDENTIFIER = 43; + public int JJTWHERECLAUSE = 44; + public int JJTORBLOCK = 45; + public int JJTANDBLOCK = 46; + public int JJTNOTBLOCK = 47; + public int JJTPARENTHESISBLOCK = 48; + public int JJTCONDITIONBLOCK = 49; + public int JJTCOMPAREOPERATOR = 50; + public int JJTLTOPERATOR = 51; + public int JJTGTOPERATOR = 52; + public int JJTNEOPERATOR = 53; + public int JJTNEQOPERATOR = 54; + public int JJTGEOPERATOR = 55; + public int JJTLEOPERATOR = 56; + public int JJTLIKEOPERATOR = 57; + public int JJTCONTAINSKEYOPERATOR = 58; + public int JJTCONTAINSVALUEOPERATOR = 59; + public int JJTEQUALSCOMPAREOPERATOR = 60; + public int JJTBINARYCONDITION = 61; + public int JJTCONTAINSVALUECONDITION = 62; + public int JJTINSTANCEOFCONDITION = 63; + public int JJTINDEXMATCHCONDITION = 64; + public int JJTBETWEENCONDITION = 65; + public int JJTISNULLCONDITION = 66; + public int JJTISNOTNULLCONDITION = 67; + public int JJTISDEFINEDCONDITION = 68; + public int JJTISNOTDEFINEDCONDITION = 69; + public int JJTCONTAINSCONDITION = 70; + public int JJTINOPERATOR = 71; + public int JJTINCONDITION = 72; + public int JJTNOTINCONDITION = 73; + public int JJTCONTAINSALLCONDITION = 74; + public int JJTCONTAINSTEXTCONDITION = 75; + public int JJTMATCHESCONDITION = 76; + public int JJTORDERBY = 77; + public int JJTGROUPBY = 78; + public int JJTLIMIT = 79; + public int JJTSKIP = 80; + public int JJTITEMSCOLLECTION = 81; public String[] jjtNodeName = { @@ -116,7 +121,12 @@ public interface OrientSqlTreeConstants "SuffixIdentifier", "BaseIdentifier", "Modifier", - "OperationChain", + "Expression", + "AddExpression", + "MultExpression", + "FirstLevelExpression", + "ParenthesisExpression", + "BaseExpression", "FromClause", "FromItem", "Cluster", @@ -162,4 +172,4 @@ public interface OrientSqlTreeConstants "ItemsCollection", }; } -/* JavaCC - OriginalChecksum=e4a7b68957736371017b18d00849dd6b (do not edit this line) */ +/* JavaCC - OriginalChecksum=32bd5d04b0c5f09958ac6070e2fb1471 (do not edit this line) */ diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlVisitor.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlVisitor.java index 11bb2703496..f1232e1e3a5 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlVisitor.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OrientSqlVisitor.java @@ -37,7 +37,12 @@ public interface OrientSqlVisitor public Object visit(OSuffixIdentifier node, Object data); public Object visit(OBaseIdentifier node, Object data); public Object visit(OModifier node, Object data); - public Object visit(OOperationChain node, Object data); + public Object visit(OExpression node, Object data); + public Object visit(OAddExpression node, Object data); + public Object visit(OMultExpression node, Object data); + public Object visit(OFirstLevelExpression node, Object data); + public Object visit(OParenthesisExpression node, Object data); + public Object visit(OBaseExpression node, Object data); public Object visit(OFromClause node, Object data); public Object visit(OFromItem node, Object data); public Object visit(OCluster node, Object data); @@ -82,4 +87,4 @@ public interface OrientSqlVisitor public Object visit(OSkip node, Object data); public Object visit(OItemsCollection node, Object data); } -/* JavaCC - OriginalChecksum=e2f9d1bcf3918bcf9c72fbcf31aad8ae (do not edit this line) */ +/* JavaCC - OriginalChecksum=44cf72d5aee82dcb49d4eb47c7f0a576 (do not edit this line) */
2993d97c97a69906b6f790bbc0608848f26d5b48
hbase
HBASE-2806 DNS hiccups cause uncaught NPE in- HServerAddress-getBindAddress--git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@960650 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/hbase
diff --git a/CHANGES.txt b/CHANGES.txt index 3ff6dcd067ff..38be4c9c1415 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -426,6 +426,8 @@ Release 0.21.0 - Unreleased HBASE-2707 Can't recover from a dead ROOT server if any exceptions happens during log splitting HBASE-2501 Refactor StoreFile Code + HBASE-2806 DNS hiccups cause uncaught NPE in HServerAddress#getBindAddress + (Benoit Sigoure via Stack) IMPROVEMENTS HBASE-1760 Cleanup TODOs in HTable diff --git a/src/main/java/org/apache/hadoop/hbase/HServerAddress.java b/src/main/java/org/apache/hadoop/hbase/HServerAddress.java index e007e1ba489a..0fff4476feea 100644 --- a/src/main/java/org/apache/hadoop/hbase/HServerAddress.java +++ b/src/main/java/org/apache/hadoop/hbase/HServerAddress.java @@ -19,12 +19,14 @@ */ package org.apache.hadoop.hbase; -import org.apache.hadoop.io.*; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.io.WritableComparable; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.net.InetSocketAddress; +import java.net.InetAddress; /** * HServerAddress is a "label" for a HBase server made of host and port number. @@ -39,13 +41,14 @@ public HServerAddress() { } /** - * Construct a HServerAddress from an InetSocketAddress + * Construct an instance from an {@link InetSocketAddress}. * @param address InetSocketAddress of server */ public HServerAddress(InetSocketAddress address) { this.address = address; this.stringValue = address.getAddress().getHostAddress() + ":" + address.getPort(); + checkBindAddressCanBeResolved(); } /** @@ -53,14 +56,14 @@ public HServerAddress(InetSocketAddress address) { */ public HServerAddress(String hostAndPort) { int colonIndex = hostAndPort.lastIndexOf(':'); - if(colonIndex < 0) { + if (colonIndex < 0) { throw new IllegalArgumentException("Not a host:port pair: " + hostAndPort); } String host = hostAndPort.substring(0, colonIndex); - int port = - Integer.valueOf(hostAndPort.substring(colonIndex + 1)).intValue(); + int port = Integer.parseInt(hostAndPort.substring(colonIndex + 1)); this.address = new InetSocketAddress(host, port); this.stringValue = hostAndPort; + checkBindAddressCanBeResolved(); } /** @@ -70,38 +73,53 @@ public HServerAddress(String hostAndPort) { public HServerAddress(String bindAddress, int port) { this.address = new InetSocketAddress(bindAddress, port); this.stringValue = bindAddress + ":" + port; + checkBindAddressCanBeResolved(); } /** - * Copy-constructor - * + * Copy-constructor. * @param other HServerAddress to copy from */ public HServerAddress(HServerAddress other) { String bindAddress = other.getBindAddress(); int port = other.getPort(); this.address = new InetSocketAddress(bindAddress, port); - stringValue = bindAddress + ":" + port; + stringValue = other.stringValue; + checkBindAddressCanBeResolved(); } /** @return Bind address */ public String getBindAddress() { - return this.address.getAddress().getHostAddress(); + final InetAddress addr = address.getAddress(); + if (addr != null) { + return addr.getHostAddress(); + } else { + LogFactory.getLog(HServerAddress.class).error("Could not resolve the" + + " DNS name of " + stringValue); + return null; + } + } + + private checkBindAddressCanBeResolved() { + if (getBindAddress() == null) { + throw new IllegalArgumentException("Could not resolve the" + + " DNS name of " + stringValue); + } } /** @return Port number */ public int getPort() { - return this.address.getPort(); + return address.getPort(); } /** @return Hostname */ public String getHostname() { - return this.address.getHostName(); + return address.getHostName(); } /** @return The InetSocketAddress */ public InetSocketAddress getInetSocketAddress() { - return this.address; + return address; } /** @@ -109,7 +127,7 @@ public InetSocketAddress getInetSocketAddress() { */ @Override public String toString() { - return (this.stringValue == null ? "" : this.stringValue); + return stringValue == null ? "" : stringValue; } @Override @@ -123,13 +141,13 @@ public boolean equals(Object o) { if (getClass() != o.getClass()) { return false; } - return this.compareTo((HServerAddress)o) == 0; + return compareTo((HServerAddress) o) == 0; } @Override public int hashCode() { - int result = this.address.hashCode(); - result ^= this.stringValue.hashCode(); + int result = address.hashCode(); + result ^= stringValue.hashCode(); return result; } @@ -141,13 +159,13 @@ public void readFields(DataInput in) throws IOException { String bindAddress = in.readUTF(); int port = in.readInt(); - if(bindAddress == null || bindAddress.length() == 0) { + if (bindAddress == null || bindAddress.length() == 0) { address = null; stringValue = null; - } else { address = new InetSocketAddress(bindAddress, port); stringValue = bindAddress + ":" + port; + checkBindAddressCanBeResolved(); } } @@ -155,7 +173,6 @@ public void write(DataOutput out) throws IOException { if (address == null) { out.writeUTF(""); out.writeInt(0); - } else { out.writeUTF(address.getAddress().getHostAddress()); out.writeInt(address.getPort()); @@ -170,7 +187,7 @@ public int compareTo(HServerAddress o) { // Addresses as Strings may not compare though address is for the one // server with only difference being that one address has hostname // resolved whereas other only has IP. - if (this.address.equals(o.address)) return 0; - return this.toString().compareTo(o.toString()); + if (address.equals(o.address)) return 0; + return toString().compareTo(o.toString()); } -} \ No newline at end of file +}
0735e178dc8628cf8986dfc6c62332378a42643d
drools
allow to specify an optional Environment when- creating a new KieSession--
a
https://github.com/kiegroup/drools
diff --git a/drools-compiler/src/main/java/org/drools/cdi/KieCDIExtension.java b/drools-compiler/src/main/java/org/drools/cdi/KieCDIExtension.java index 6114c3efa3a..d8a0fbd6138 100644 --- a/drools-compiler/src/main/java/org/drools/cdi/KieCDIExtension.java +++ b/drools-compiler/src/main/java/org/drools/cdi/KieCDIExtension.java @@ -63,9 +63,7 @@ public class KieCDIExtension private final static AnnotationLiteral<Any> anyAnnLit = new AnnotationLiteral<Any>() { }; - public KieCDIExtension() { - System.out.println("create KieCDIExtension"); - } + public KieCDIExtension() { } public void init() { KieServices ks = KieServices.Factory.get(); @@ -109,19 +107,16 @@ public <Object> void processInjectionTarget(@Observes ProcessInjectionTarget<Obj Class< ? extends Annotation> scope = ApplicationScoped.class; - KieCDIEntry existingEntry = null; if ( kBase != null ) { - addKBaseInjectionPoint(ip, kBase, namedStr, scope, gav, existingEntry); - - continue; + addKBaseInjectionPoint(ip, kBase, namedStr, scope, gav); } else if ( kSession != null ) { - addKSessionInjectionPoint(ip, kSession, namedStr, scope, gav, existingEntry); + addKSessionInjectionPoint(ip, kSession, namedStr, scope, gav); } } } } - public void addKBaseInjectionPoint(InjectionPoint ip, KBase kBase, String namedStr, Class< ? extends Annotation> scope, GAV gav, KieCDIEntry existingEntry) { + public void addKBaseInjectionPoint(InjectionPoint ip, KBase kBase, String namedStr, Class< ? extends Annotation> scope, GAV gav) { if ( kBaseNames == null ) { kBaseNames = new HashMap<KieCDIEntry, KieCDIEntry>(); } @@ -131,7 +126,7 @@ public void addKBaseInjectionPoint(InjectionPoint ip, KBase kBase, String namedS gav, namedStr ); - existingEntry = kBaseNames.remove( newEntry ); + KieCDIEntry existingEntry = kBaseNames.remove( newEntry ); if ( existingEntry != null ) { // it already exists, so just update its Set of InjectionPoints // Note any duplicate "named" would be handled via this. @@ -159,7 +154,7 @@ public void addKBaseInjectionPoint(InjectionPoint ip, KBase kBase, String namedS } } - public void addKSessionInjectionPoint(InjectionPoint ip, KSession kSession, String namedStr, Class< ? extends Annotation> scope, GAV gav, KieCDIEntry existingEntry) { + public void addKSessionInjectionPoint(InjectionPoint ip, KSession kSession, String namedStr, Class< ? extends Annotation> scope, GAV gav) { if ( kSessionNames == null ) { kSessionNames = new HashMap<KieCDIEntry, KieCDIEntry>(); } @@ -169,7 +164,7 @@ public void addKSessionInjectionPoint(InjectionPoint ip, KSession kSession, Stri gav, namedStr ); - existingEntry = kSessionNames.remove( newEntry ); + KieCDIEntry existingEntry = kSessionNames.remove( newEntry ); if ( existingEntry != null ) { // it already exists, so just update its Set of InjectionPoints // Note any duplicate "named" would be handled via this. diff --git a/drools-compiler/src/main/java/org/kie/builder/impl/KieContainerImpl.java b/drools-compiler/src/main/java/org/kie/builder/impl/KieContainerImpl.java index 23d2a3cd3df..21f22049a20 100644 --- a/drools-compiler/src/main/java/org/kie/builder/impl/KieContainerImpl.java +++ b/drools-compiler/src/main/java/org/kie/builder/impl/KieContainerImpl.java @@ -12,6 +12,7 @@ import org.kie.builder.KieSessionModel; import org.kie.builder.Results; import org.kie.builder.Message.Level; +import org.kie.runtime.Environment; import org.kie.runtime.KieSession; import org.kie.runtime.KnowledgeSessionConfiguration; import org.kie.runtime.StatelessKieSession; @@ -84,11 +85,15 @@ public KieBase getKieBase(String kBaseName) { } public KieSession newKieSession() { + return newKieSession((Environment)null); + } + + public KieSession newKieSession(Environment environment) { KieSessionModel defaultKieSessionModel = kProject.getDefaultKieSession(); if (defaultKieSessionModel == null) { new RuntimeException("Cannot find a defualt KieSession"); } - return newKieSession(defaultKieSessionModel.getName()); + return newKieSession(defaultKieSessionModel.getName(), environment); } public StatelessKieSession newKieStatelessSession() { @@ -100,6 +105,10 @@ public StatelessKieSession newKieStatelessSession() { } public KieSession newKieSession(String kSessionName) { + return newKieSession(kSessionName, null); + } + + public KieSession newKieSession(String kSessionName, Environment environment) { KieSessionModelImpl kSessionModel = (KieSessionModelImpl) kProject.getKieSessionModel( kSessionName ); if ( kSessionModel == null ) { log.error("Unknown KieSession name: " + kSessionName); @@ -110,7 +119,7 @@ public KieSession newKieSession(String kSessionName) { log.error("Unknown KieBase name: " + kSessionModel.getKieBaseModel().getName()); return null; } - KieSession kSession = kBase.newKieSession(getKnowledgeSessionConfiguration(kSessionModel), null); + KieSession kSession = kBase.newKieSession(getKnowledgeSessionConfiguration(kSessionModel), environment); wireListnersAndWIHs(kSessionModel, kSession); return kSession; }
1c52b6551b63053b261f4ac821093a8a203de596
hadoop
YARN-2705. Fixed bugs in ResourceManager node-label- manager that were causing test-failures: added a dummy in-memory- labels-manager. Contributed by Wangda Tan.--(cherry picked from commit e9c66e8fd2ccb658db2848e1ab911f1502de4de5)-
c
https://github.com/apache/hadoop
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 0300b2e6a359b..63e0e6c94bda7 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -570,6 +570,10 @@ Release 2.6.0 - UNRELEASED YARN-2699. Fixed a bug in CommonNodeLabelsManager that caused tests to fail when using ephemeral ports on NodeIDs. (Wangda Tan via vinodkv) + YARN-2705. Fixed bugs in ResourceManager node-label manager that were causing + test-failures: added a dummy in-memory labels-manager. (Wangda Tan via + vinodkv) + BREAKDOWN OF YARN-1051 SUBTASKS AND RELATED JIRAS YARN-1707. Introduce APIs to add/remove/resize queues in the diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index a5e746451e7e8..03a1f6011e0e5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -1457,10 +1457,16 @@ public class YarnConfiguration extends Configuration { public static final String NODE_LABELS_PREFIX = YARN_PREFIX + "node-labels."; + /** + * Class for RMNodeLabelsManager Please note this value should be consistent + * in client nodes and RM node(s) + */ + public static final String RM_NODE_LABELS_MANAGER_CLASS = NODE_LABELS_PREFIX + + "manager-class"; + /** URI for NodeLabelManager */ - public static final String FS_NODE_LABELS_STORE_URI = NODE_LABELS_PREFIX - + "fs-store.uri"; - public static final String DEFAULT_FS_NODE_LABELS_STORE_URI = "file:///tmp/"; + public static final String FS_NODE_LABELS_STORE_ROOT_DIR = NODE_LABELS_PREFIX + + "fs-store.root-dir"; public static final String FS_NODE_LABELS_STORE_RETRY_POLICY_SPEC = NODE_LABELS_PREFIX + "fs-store.retry-policy-spec"; public static final String DEFAULT_FS_NODE_LABELS_STORE_RETRY_POLICY_SPEC = diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java index 8bb88f27c6539..d68503555f24d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java @@ -220,9 +220,11 @@ protected void serviceStart() throws Exception { // service init, we don't want to trigger any event handling at that time. initDispatcher(getConfig()); - dispatcher.register(NodeLabelsStoreEventType.class, - new ForwardingEventHandler()); - + if (null != dispatcher) { + dispatcher.register(NodeLabelsStoreEventType.class, + new ForwardingEventHandler()); + } + startDispatcher(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java index 2778c742a2d1a..6e685ee3301d6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/FileSystemNodeLabelsStore.java @@ -32,6 +32,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.AddToClusterNodeLabelsRequestProto; @@ -54,7 +55,7 @@ public FileSystemNodeLabelsStore(CommonNodeLabelsManager mgr) { protected static final Log LOG = LogFactory.getLog(FileSystemNodeLabelsStore.class); - protected static final String ROOT_DIR_NAME = "FSNodeLabelManagerRoot"; + protected static final String DEFAULT_DIR_NAME = "node-labels"; protected static final String MIRROR_FILENAME = "nodelabel.mirror"; protected static final String EDITLOG_FILENAME = "nodelabel.editlog"; @@ -63,22 +64,27 @@ protected enum SerializedLogType { } Path fsWorkingPath; - Path rootDirPath; FileSystem fs; FSDataOutputStream editlogOs; Path editLogPath; + + private String getDefaultFSNodeLabelsRootDir() throws IOException { + // default is in local: /tmp/hadoop-yarn-${user}/node-labels/ + return "file:///tmp/hadoop-yarn-" + + UserGroupInformation.getCurrentUser().getShortUserName() + "/" + + DEFAULT_DIR_NAME; + } @Override public void init(Configuration conf) throws Exception { fsWorkingPath = - new Path(conf.get(YarnConfiguration.FS_NODE_LABELS_STORE_URI, - YarnConfiguration.DEFAULT_FS_NODE_LABELS_STORE_URI)); - rootDirPath = new Path(fsWorkingPath, ROOT_DIR_NAME); + new Path(conf.get(YarnConfiguration.FS_NODE_LABELS_STORE_ROOT_DIR, + getDefaultFSNodeLabelsRootDir())); setFileSystem(conf); // mkdir of root dir path - fs.mkdirs(rootDirPath); + fs.mkdirs(fsWorkingPath); } @Override @@ -159,8 +165,8 @@ public void recover() throws IOException { */ // Open mirror from serialized file - Path mirrorPath = new Path(rootDirPath, MIRROR_FILENAME); - Path oldMirrorPath = new Path(rootDirPath, MIRROR_FILENAME + ".old"); + Path mirrorPath = new Path(fsWorkingPath, MIRROR_FILENAME); + Path oldMirrorPath = new Path(fsWorkingPath, MIRROR_FILENAME + ".old"); FSDataInputStream is = null; if (fs.exists(mirrorPath)) { @@ -183,7 +189,7 @@ public void recover() throws IOException { } // Open and process editlog - editLogPath = new Path(rootDirPath, EDITLOG_FILENAME); + editLogPath = new Path(fsWorkingPath, EDITLOG_FILENAME); if (fs.exists(editLogPath)) { is = fs.open(editLogPath); @@ -224,7 +230,7 @@ public void recover() throws IOException { } // Serialize current mirror to mirror.writing - Path writingMirrorPath = new Path(rootDirPath, MIRROR_FILENAME + ".writing"); + Path writingMirrorPath = new Path(fsWorkingPath, MIRROR_FILENAME + ".writing"); FSDataOutputStream os = fs.create(writingMirrorPath, true); ((AddToClusterNodeLabelsRequestPBImpl) AddToClusterNodeLabelsRequestPBImpl .newInstance(mgr.getClusterNodeLabels())).getProto().writeDelimitedTo(os); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/TestFileSystemNodeLabelsStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/TestFileSystemNodeLabelsStore.java index a7546cb70406f..45a2d8d32f214 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/TestFileSystemNodeLabelsStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/TestFileSystemNodeLabelsStore.java @@ -67,7 +67,7 @@ public void before() throws IOException { tempDir.delete(); tempDir.mkdirs(); tempDir.deleteOnExit(); - conf.set(YarnConfiguration.FS_NODE_LABELS_STORE_URI, + conf.set(YarnConfiguration.FS_NODE_LABELS_STORE_ROOT_DIR, tempDir.getAbsolutePath()); mgr.init(conf); mgr.start(); @@ -75,7 +75,7 @@ public void before() throws IOException { @After public void after() throws IOException { - getStore().fs.delete(getStore().rootDirPath, true); + getStore().fs.delete(getStore().fsWorkingPath, true); mgr.stop(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java index bcf7a5488452a..51ed2b1a9b9e3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java @@ -67,6 +67,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher; import org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingEditPolicy; import org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingMonitor; +import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.MemoryRMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.recovery.NullRMStateStore; import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; @@ -321,8 +322,12 @@ protected AMLivelinessMonitor createAMLivelinessMonitor() { return new AMLivelinessMonitor(this.rmDispatcher); } - protected RMNodeLabelsManager createNodeLabelManager() { - return new RMNodeLabelsManager(); + protected RMNodeLabelsManager createNodeLabelManager() + throws InstantiationException, IllegalAccessException { + Class<? extends RMNodeLabelsManager> nlmCls = + conf.getClass(YarnConfiguration.RM_NODE_LABELS_MANAGER_CLASS, + MemoryRMNodeLabelsManager.class, RMNodeLabelsManager.class); + return nlmCls.newInstance(); } protected DelegationTokenRenewer createDelegationTokenRenewer() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/DummyRMNodeLabelsManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/MemoryRMNodeLabelsManager.java similarity index 93% rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/DummyRMNodeLabelsManager.java rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/MemoryRMNodeLabelsManager.java index 14bd99984c5b9..89053ca9baa4a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/DummyRMNodeLabelsManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/MemoryRMNodeLabelsManager.java @@ -25,10 +25,9 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.api.records.NodeId; -import org.apache.hadoop.yarn.event.InlineDispatcher; import org.apache.hadoop.yarn.nodelabels.NodeLabelsStore; -public class DummyRMNodeLabelsManager extends RMNodeLabelsManager { +public class MemoryRMNodeLabelsManager extends RMNodeLabelsManager { Map<NodeId, Set<String>> lastNodeToLabels = null; Collection<String> lastAddedlabels = null; Collection<String> lastRemovedlabels = null; @@ -68,7 +67,7 @@ public void close() throws IOException { @Override protected void initDispatcher(Configuration conf) { - super.dispatcher = new InlineDispatcher(); + super.dispatcher = null; } @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java index 0c70f68c71393..9d0ac2739bc66 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java @@ -59,7 +59,7 @@ import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEvent; import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.ApplicationMasterLauncher; -import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.DummyRMNodeLabelsManager; +import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.MemoryRMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; @@ -115,7 +115,7 @@ public MockRM(Configuration conf, RMStateStore store) { @Override protected RMNodeLabelsManager createNodeLabelManager() { - RMNodeLabelsManager mgr = new DummyRMNodeLabelsManager(); + RMNodeLabelsManager mgr = new MemoryRMNodeLabelsManager(); mgr.init(getConfig()); return mgr; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/TestRMNodeLabelsManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/TestRMNodeLabelsManager.java index 1fbe96869fb2d..0ea745692b83b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/TestRMNodeLabelsManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/TestRMNodeLabelsManager.java @@ -42,11 +42,11 @@ public class TestRMNodeLabelsManager extends NodeLabelTestBase { private final Resource SMALL_RESOURCE = Resource.newInstance(100, 0); private final Resource LARGE_NODE = Resource.newInstance(1000, 0); - DummyRMNodeLabelsManager mgr = null; + MemoryRMNodeLabelsManager mgr = null; @Before public void before() { - mgr = new DummyRMNodeLabelsManager(); + mgr = new MemoryRMNodeLabelsManager(); mgr.init(new Configuration()); mgr.start(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java index e15c87d00e03f..98dc673da2563 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java @@ -84,7 +84,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.Task; import org.apache.hadoop.yarn.server.resourcemanager.TestAMAuthorization.MockRMWithAMS; import org.apache.hadoop.yarn.server.resourcemanager.TestAMAuthorization.MyContainerManager; -import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.DummyRMNodeLabelsManager; +import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.MemoryRMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics; @@ -154,7 +154,7 @@ public void setUp() throws Exception { resourceManager = new ResourceManager() { @Override protected RMNodeLabelsManager createNodeLabelManager() { - RMNodeLabelsManager mgr = new DummyRMNodeLabelsManager(); + RMNodeLabelsManager mgr = new MemoryRMNodeLabelsManager(); mgr.init(getConfig()); return mgr; } @@ -1485,7 +1485,7 @@ public void testMoveAppViolateQueueState() throws Exception { resourceManager = new ResourceManager() { @Override protected RMNodeLabelsManager createNodeLabelManager() { - RMNodeLabelsManager mgr = new DummyRMNodeLabelsManager(); + RMNodeLabelsManager mgr = new MemoryRMNodeLabelsManager(); mgr.init(getConfig()); return mgr; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestContainerAllocation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestContainerAllocation.java index b84717bbc328c..b90df8ec5a769 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestContainerAllocation.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestContainerAllocation.java @@ -45,7 +45,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.RMSecretManagerService; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.TestFifoScheduler; -import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.DummyRMNodeLabelsManager; +import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.MemoryRMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt; @@ -81,7 +81,7 @@ public void setUp() throws Exception { conf = new YarnConfiguration(); conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class, ResourceScheduler.class); - mgr = new DummyRMNodeLabelsManager(); + mgr = new MemoryRMNodeLabelsManager(); mgr.init(conf); } @@ -446,7 +446,7 @@ private Configuration getComplexConfigurationWithQueueLabels( @Test(timeout = 300000) public void testContainerAllocationWithSingleUserLimits() throws Exception { - final RMNodeLabelsManager mgr = new DummyRMNodeLabelsManager(); + final RMNodeLabelsManager mgr = new MemoryRMNodeLabelsManager(); mgr.init(conf); // set node -> label diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java index 7e6165274b28a..abc701db192fb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java @@ -39,7 +39,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.MockAsm; -import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.DummyRMNodeLabelsManager; +import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.MemoryRMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; @@ -179,7 +179,7 @@ public ConcurrentMap<NodeId, RMNode> getRMNodes() { return nodesMap; } }; - rmContext.setNodeLabelManager(new DummyRMNodeLabelsManager()); + rmContext.setNodeLabelManager(new MemoryRMNodeLabelsManager()); return rmContext; } @@ -211,7 +211,7 @@ public static CapacityScheduler mockCapacityScheduler() throws IOException { null, new RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), new ClientToAMTokenSecretManagerInRM(), null); - rmContext.setNodeLabelManager(new DummyRMNodeLabelsManager()); + rmContext.setNodeLabelManager(new MemoryRMNodeLabelsManager()); cs.setRMContext(rmContext); cs.init(conf); return cs;
7be3d247f90c23bbb11bc735276d51008243a7f6
kotlin
fix tests after recent refactoring--
c
https://github.com/JetBrains/kotlin
diff --git a/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java b/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java index 7d4c7ea5f85c2..1d1445118ddd3 100644 --- a/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java +++ b/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java @@ -85,7 +85,7 @@ public CompileEnvironment(MessageRenderer messageRenderer, boolean verbose, Comp public void dispose() { } }; - environment = new JetCoreEnvironment(rootDisposable, mode == CompilerSpecialMode.REGULAR); + environment = new JetCoreEnvironment(rootDisposable, mode.includeJdkHeaders()); this.messageRenderer = messageRenderer; } @@ -282,7 +282,7 @@ private List<Module> runDefineModules(String moduleFile, ClassFileFactory factor public ClassFileFactory compileModule(Module moduleBuilder, String directory) { CompileSession moduleCompileSession = newCompileSession(); - moduleCompileSession.setStubs(mode != CompilerSpecialMode.REGULAR); + moduleCompileSession.setStubs(mode.isStubs()); if (moduleBuilder.getSourceFiles().isEmpty()) { throw new CompileEnvironmentException("No source files where defined"); @@ -403,7 +403,7 @@ public ClassLoader compileText(String code) { public boolean compileBunchOfSources(String sourceFileOrDir, String jar, String outputDir, boolean includeRuntime) { CompileSession session = newCompileSession(); - session.setStubs(mode != CompilerSpecialMode.REGULAR); + session.setStubs(mode.isStubs()); session.addSources(sourceFileOrDir); @@ -412,7 +412,7 @@ public boolean compileBunchOfSources(String sourceFileOrDir, String jar, String public boolean compileBunchOfSourceDirectories(List<String> sources, String jar, String outputDir, boolean includeRuntime) { CompileSession session = newCompileSession(); - session.setStubs(mode != CompilerSpecialMode.REGULAR); + session.setStubs(mode.isStubs()); for (String source : sources) { session.addSources(source); diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerSpecialMode.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerSpecialMode.java index 91535c783ed51..4fa7a42372cef 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerSpecialMode.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerSpecialMode.java @@ -29,4 +29,8 @@ public enum CompilerSpecialMode { public boolean includeJdkHeaders() { return this == REGULAR || this == STDLIB; } + + public boolean isStubs() { + return this == BUILTINS || this == JDK_HEADERS; + } }
a00785136b533e563a9ca408aeaed500f7ad2295
hbase
HBASE-8351 Minor typo in Bytes- IllegalArgumentException throw (Raymond Liu)--git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1468291 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/hbase
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java index 30fa08bb6040..edd75a903883 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java @@ -1404,7 +1404,7 @@ public static Iterable<byte[]> iterateOnSplits( throw new IllegalArgumentException("b <= a"); } if (num <= 0) { - throw new IllegalArgumentException("num cannot be < 0"); + throw new IllegalArgumentException("num cannot be <= 0"); } byte [] prependHeader = {1, 0}; final BigInteger startBI = new BigInteger(add(prependHeader, aPadded));
91b74931a3d858645cf106295090a11e803c3e83
elasticsearch
[TEST] Stabelize MoreLikeThisActionTests--The `testCompareMoreLikeThisDSLWithAPI` test compares results from query-and API which might query different shards. Those shares might use-different doc IDs internally to disambiguate. This commit resorts the-results and compares them after stable disambiguation.-
c
https://github.com/elastic/elasticsearch
diff --git a/src/test/java/org/elasticsearch/mlt/MoreLikeThisActionTests.java b/src/test/java/org/elasticsearch/mlt/MoreLikeThisActionTests.java index 19c577fd1d2ca..1ea485a3c437b 100644 --- a/src/test/java/org/elasticsearch/mlt/MoreLikeThisActionTests.java +++ b/src/test/java/org/elasticsearch/mlt/MoreLikeThisActionTests.java @@ -19,6 +19,7 @@ package org.elasticsearch.mlt; +import org.apache.lucene.util.ArrayUtil; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.index.IndexRequestBuilder; @@ -37,6 +38,7 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import static org.elasticsearch.client.Requests.*; @@ -407,17 +409,33 @@ public void testCompareMoreLikeThisDSLWithAPI() throws Exception { .setSearchType(SearchType.QUERY_THEN_FETCH) .setTypes("type1") .setQuery(queryBuilder) + .setSize(texts.length) .execute().actionGet(); assertSearchResponse(mltResponseDSL); logger.info("Running MoreLikeThis API"); - MoreLikeThisRequest mltRequest = moreLikeThisRequest("test").type("type1").id("0").minTermFreq(1).minDocFreq(1); + MoreLikeThisRequest mltRequest = moreLikeThisRequest("test").type("type1").searchSize(texts.length).id("0").minTermFreq(1).minDocFreq(1); SearchResponse mltResponseAPI = client.moreLikeThis(mltRequest).actionGet(); assertSearchResponse(mltResponseAPI); logger.info("Ensure the documents and scores returned are the same."); SearchHit[] hitsDSL = mltResponseDSL.getHits().hits(); SearchHit[] hitsAPI = mltResponseAPI.getHits().hits(); + + // we have to resort since the results might come from + // different shards and docIDs that are used for tie-breaking might not be the same on the shards + Comparator<SearchHit> cmp = new Comparator<SearchHit>() { + + @Override + public int compare(SearchHit o1, SearchHit o2) { + if (Float.compare(o1.getScore(), o2.getScore()) == 0) { + return o1.getId().compareTo(o2.getId()); + } + return Float.compare(o1.getScore(), o2.getScore()); + } + }; + ArrayUtil.timSort(hitsDSL, cmp); + ArrayUtil.timSort(hitsAPI, cmp); assertThat("Not the same number of results.", hitsAPI.length, equalTo(hitsDSL.length)); for (int i = 0; i < hitsDSL.length; i++) { assertThat("Expected id: " + hitsDSL[i].getId() + " at position " + i + " but wasn't.",
b727e15dffbfa9621bc1b4e80b6b7786e370f5b0
camel
CAMEL-2325: Removed not needed code.--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@895568 13f79535-47bb-0310-9956-ffa450edef68-
p
https://github.com/apache/camel
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java index fad8a4adb39f6..d550155c693fa 100644 --- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java +++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java @@ -133,15 +133,6 @@ public void process(Exchange exchange) throws Exception { // remove temporary header in.removeHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY); - // if there was bean invocation as body and we are invoking the same bean - // then invoke it - if (beanInvoke != null && beanInvoke.getMethod() == invocation.getMethod()) { - beanInvoke.invoke(bean, exchange); - // propagate headers - exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders()); - return; - } - Object value = null; try { value = invocation.proceed();
a725717261c347366e5bc36d95ade9b3ec0109a9
spring-framework
tests for custom conversion service / validator--
p
https://github.com/spring-projects/spring-framework
diff --git a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java index 68db7132d2f0..e4f2fda92d51 100644 --- a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java +++ b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java @@ -1,13 +1,19 @@ package org.springframework.web.servlet.config; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.Date; import java.util.Locale; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + import org.junit.Before; import org.junit.Test; +import org.springframework.beans.ConversionNotSupportedException; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.core.io.ClassPathResource; @@ -17,6 +23,9 @@ import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletContext; import org.springframework.stereotype.Controller; +import org.springframework.validation.BindingResult; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.context.support.GenericWebApplicationContext; @@ -52,14 +61,93 @@ public void testDefaultConfig() throws Exception { request.addParameter("date", "2009-10-31"); MockHttpServletResponse response = new MockHttpServletResponse(); adapter.handle(request, response, handler); + assertTrue(handler.recordedValidationError); } - + + @Test(expected=ConversionNotSupportedException.class) + public void testCustomConversionService() throws Exception { + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(container); + reader.loadBeanDefinitions(new ClassPathResource("mvc-config-custom-conversion-service.xml", getClass())); + assertEquals(3, container.getBeanDefinitionCount()); + DefaultAnnotationHandlerMapping mapping = container.getBean(DefaultAnnotationHandlerMapping.class); + assertNotNull(mapping); + assertEquals(0, mapping.getOrder()); + AnnotationMethodHandlerAdapter adapter = container.getBean(AnnotationMethodHandlerAdapter.class); + assertNotNull(adapter); + + TestController handler = new TestController(); + + // default web binding initializer behavior test + MockHttpServletRequest request = new MockHttpServletRequest(); + request.addParameter("date", "2009-10-31"); + MockHttpServletResponse response = new MockHttpServletResponse(); + adapter.handle(request, response, handler); + } + + @Test + public void testCustomValidator() throws Exception { + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(container); + reader.loadBeanDefinitions(new ClassPathResource("mvc-config-custom-validator.xml", getClass())); + assertEquals(3, container.getBeanDefinitionCount()); + DefaultAnnotationHandlerMapping mapping = container.getBean(DefaultAnnotationHandlerMapping.class); + assertNotNull(mapping); + assertEquals(0, mapping.getOrder()); + AnnotationMethodHandlerAdapter adapter = container.getBean(AnnotationMethodHandlerAdapter.class); + assertNotNull(adapter); + + TestController handler = new TestController(); + + // default web binding initializer behavior test + MockHttpServletRequest request = new MockHttpServletRequest(); + request.addParameter("date", "2009-10-31"); + MockHttpServletResponse response = new MockHttpServletResponse(); + adapter.handle(request, response, handler); + + assertTrue(container.getBean(TestValidator.class).validatorInvoked); + assertFalse(handler.recordedValidationError); + } + @Controller public static class TestController { + private boolean recordedValidationError; + @RequestMapping - public void testBind(@RequestParam @DateTimeFormat(iso=ISO.DATE) Date date) { - + public void testBind(@RequestParam @DateTimeFormat(iso=ISO.DATE) Date date, @Valid TestBean bean, BindingResult result) { + if (result.getErrorCount() == 1) { + this.recordedValidationError = true; + } else { + this.recordedValidationError = false; + } } } + + public static class TestValidator implements Validator { + + boolean validatorInvoked; + + public boolean supports(Class<?> clazz) { + return true; + } + + public void validate(Object target, Errors errors) { + this.validatorInvoked = true; + } + + } + + private static class TestBean { + + @NotNull + private String field; + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + } } diff --git a/org.springframework.web.servlet/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-conversion-service.xml b/org.springframework.web.servlet/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-conversion-service.xml new file mode 100644 index 000000000000..334c20d7f90d --- /dev/null +++ b/org.springframework.web.servlet/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-conversion-service.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> + + <mvc:annotation-driven conversion-service="conversionService" /> + + <bean id="conversionService" class="org.springframework.core.convert.support.DefaultConversionService" /> + +</beans> diff --git a/org.springframework.web.servlet/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-validator.xml b/org.springframework.web.servlet/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-validator.xml new file mode 100644 index 000000000000..31e46473e32c --- /dev/null +++ b/org.springframework.web.servlet/src/test/resources/org/springframework/web/servlet/config/mvc-config-custom-validator.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> + + <mvc:annotation-driven validator="validator"/> + + <bean id="validator" class="org.springframework.web.servlet.config.MvcNamespaceTests$TestValidator" /> + +</beans>
4cbe2ae00aaec2ca4074b06f389f5e50ca235da3
spring-framework
[SPR-8387] Introduced- supports(MergedContextConfiguration) method in the SmartContextLoader SPI;- updated existing loaders accordingly; and fleshed out implementation of and- tests for the new DelegatingSmartContextLoader.--
a
https://github.com/spring-projects/spring-framework
diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/SmartContextLoader.java b/org.springframework.test/src/main/java/org/springframework/test/context/SmartContextLoader.java index 683a200d54b8..16f8655e0a86 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/SmartContextLoader.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/SmartContextLoader.java @@ -95,6 +95,14 @@ public interface SmartContextLoader extends ContextLoader { */ void processContextConfiguration(ContextConfigurationAttributes configAttributes); + /** + * TODO Document supports(MergedContextConfiguration). + * + * @param mergedConfig + * @return + */ + boolean supports(MergedContextConfiguration mergedConfig); + /** * Loads a new {@link ApplicationContext context} based on the supplied * {@link MergedContextConfiguration merged context configuration}, diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/support/AbstractContextLoader.java b/org.springframework.test/src/main/java/org/springframework/test/context/support/AbstractContextLoader.java index faf88f520e12..a8d3261115f7 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/support/AbstractContextLoader.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/support/AbstractContextLoader.java @@ -23,6 +23,7 @@ import org.springframework.core.io.support.ResourcePatternUtils; import org.springframework.test.context.ContextConfigurationAttributes; import org.springframework.test.context.ContextLoader; +import org.springframework.test.context.MergedContextConfiguration; import org.springframework.test.context.SmartContextLoader; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -90,6 +91,13 @@ public void processContextConfiguration(ContextConfigurationAttributes configAtt configAttributes.setLocations(processedLocations); } + /** + * TODO Document default supports(MergedContextConfiguration) implementation. + */ + public boolean supports(MergedContextConfiguration mergedConfig) { + return !ObjectUtils.isEmpty(mergedConfig.getLocations()); + } + // --- ContextLoader ------------------------------------------------------- /** diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java b/org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java index bdb8adad6cdf..87599eb13b13 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java @@ -81,6 +81,14 @@ public void processContextConfiguration(ContextConfigurationAttributes configAtt } } + /** + * TODO Document overridden supports(MergedContextConfiguration) implementation. + */ + @Override + public boolean supports(MergedContextConfiguration mergedConfig) { + return ObjectUtils.isEmpty(mergedConfig.getLocations()) && !ObjectUtils.isEmpty(mergedConfig.getClasses()); + } + // --- AnnotationConfigContextLoader --------------------------------------- private boolean isStaticNonPrivateAndNonFinal(Class<?> clazz) { diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java b/org.springframework.test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java index 8e4de5d39957..6aa828a1c968 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java @@ -26,6 +26,7 @@ import org.springframework.test.context.ContextLoader; import org.springframework.test.context.MergedContextConfiguration; import org.springframework.test.context.SmartContextLoader; +import org.springframework.util.ObjectUtils; /** * TODO Document DelegatingSmartContextLoader. @@ -62,6 +63,11 @@ public boolean generatesDefaults() { * TODO Document processContextConfiguration() implementation. */ public void processContextConfiguration(ContextConfigurationAttributes configAttributes) { + + final String[] originalLocations = configAttributes.getLocations(); + final Class<?>[] originalClasses = configAttributes.getClasses(); + final boolean emptyResources = ObjectUtils.isEmpty(originalLocations) && ObjectUtils.isEmpty(originalClasses); + for (SmartContextLoader loader : candidates) { if (logger.isDebugEnabled()) { logger.debug(String.format("Delegating to loader [%s] to process context configuration [%s].", @@ -73,7 +79,9 @@ public void processContextConfiguration(ContextConfigurationAttributes configAtt // If the original locations and classes are not empty, there's no // need to bother with default generation checks; just let each // loader process the configuration. - // + if (!emptyResources) { + loader.processContextConfiguration(configAttributes); + } // Otherwise, if a loader claims to generate defaults, let it // process the configuration, and then verify that it actually did // generate defaults. @@ -83,9 +91,26 @@ public void processContextConfiguration(ContextConfigurationAttributes configAtt // 1) stop iterating // 2) mark the current loader as the winning candidate (?) // 3) log an info message. + else { + if (loader.generatesDefaults()) { + loader.processContextConfiguration(configAttributes); + } + } + } + // If any loader claims to generate defaults but none actually did, + // throw an exception. + } - loader.processContextConfiguration(configAttributes); + /** + * TODO Document supports(MergedContextConfiguration) implementation. + */ + public boolean supports(MergedContextConfiguration mergedConfig) { + for (SmartContextLoader loader : candidates) { + if (loader.supports(mergedConfig)) { + return true; + } } + return false; } /** @@ -99,21 +124,16 @@ public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) t loader.getClass().getName(), mergedConfig)); } - // TODO Implement loadContext(MergedContextConfiguration). - // - // Ask each loader if it _can_ load a context from the mergedConfig. + // Ask each loader if it can load a context from the mergedConfig. // If a loader can, let it; otherwise, continue iterating over all // remaining candidates. - // - // If no candidate can load a context from the mergedConfig, throw - // an exception. + if (loader.supports(mergedConfig)) { + return loader.loadContext(mergedConfig); + } } - // TODO Implement delegation logic. - // - // Proof of concept: ensuring that hard-coded delegation to - // GenericXmlContextLoader works "as is". - return candidates.get(0).loadContext(mergedConfig); + throw new IllegalStateException(String.format("None of the candidate SmartContextLoaders [%s] " + + "was able to load an ApplicationContext from [%s].", candidates, mergedConfig)); } // --- ContextLoader ------------------------------------------------------- diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4SuiteTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4SuiteTests.java index 40a89205730e..f9096ab5f067 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4SuiteTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4SuiteTests.java @@ -26,6 +26,13 @@ import org.springframework.test.context.junit4.annotation.BeanOverridingExplicitConfigClassesInheritedTests; import org.springframework.test.context.junit4.annotation.DefaultConfigClassesBaseTests; import org.springframework.test.context.junit4.annotation.DefaultConfigClassesInheritedTests; +import org.springframework.test.context.junit4.annotation.DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests; +import org.springframework.test.context.junit4.annotation.DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests; +import org.springframework.test.context.junit4.annotation.DefaultLoaderDefaultConfigClassesBaseTests; +import org.springframework.test.context.junit4.annotation.DefaultLoaderDefaultConfigClassesInheritedTests; +import org.springframework.test.context.junit4.annotation.DefaultLoaderExplicitConfigClassesBaseTests; +import org.springframework.test.context.junit4.annotation.DefaultLoaderExplicitConfigClassesInheritedTests; +import org.springframework.test.context.junit4.annotation.ExplicitConfigClassesBaseTests; import org.springframework.test.context.junit4.annotation.ExplicitConfigClassesInheritedTests; import org.springframework.test.context.junit4.orm.HibernateSessionFlushingTests; import org.springframework.test.context.junit4.profile.annotation.DefaultProfileAnnotationConfigTests; @@ -58,12 +65,19 @@ DefaultConfigClassesBaseTests.class,// DefaultConfigClassesInheritedTests.class,// BeanOverridingDefaultConfigClassesInheritedTests.class,// + ExplicitConfigClassesBaseTests.class,// ExplicitConfigClassesInheritedTests.class,// BeanOverridingExplicitConfigClassesInheritedTests.class,// + DefaultLoaderDefaultConfigClassesBaseTests.class,// + DefaultLoaderDefaultConfigClassesInheritedTests.class,// + DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.class,// + DefaultLoaderExplicitConfigClassesBaseTests.class,// + DefaultLoaderExplicitConfigClassesInheritedTests.class,// + DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.class,// DefaultProfileAnnotationConfigTests.class,// - DevProfileAnnotationConfigTests.class, // + DevProfileAnnotationConfigTests.class,// DefaultProfileXmlConfigTests.class,// - DevProfileXmlConfigTests.class, // + DevProfileXmlConfigTests.class,// ExpectedExceptionSpringRunnerTests.class,// TimedSpringRunnerTests.class,// RepeatedSpringRunnerTests.class,// diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests.java index 7c7cef5c5440..e83eaddd33d0 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests.java @@ -18,7 +18,6 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunnerAppCtxTests; -import org.springframework.test.context.support.AnnotationConfigContextLoader; /** * Integration tests that verify support for configuration classes in @@ -34,7 +33,7 @@ * @author Sam Brannen * @since 3.1 */ -@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = PojoAndStringConfig.class, inheritLocations = false) +@ContextConfiguration(classes = PojoAndStringConfig.class, inheritLocations = false) public class AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests extends SpringJUnit4ClassRunnerAppCtxTests { /* all tests are in the parent class. */ } diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigTestSuite.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigTestSuite.java index e2ff34c6625e..f0dde3f7ea25 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigTestSuite.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigTestSuite.java @@ -34,8 +34,15 @@ DefaultConfigClassesBaseTests.class,// DefaultConfigClassesInheritedTests.class,// BeanOverridingDefaultConfigClassesInheritedTests.class,// + ExplicitConfigClassesBaseTests.class,// + ExplicitConfigClassesInheritedTests.class,// BeanOverridingExplicitConfigClassesInheritedTests.class,// - ExplicitConfigClassesInheritedTests.class // + DefaultLoaderDefaultConfigClassesBaseTests.class,// + DefaultLoaderDefaultConfigClassesInheritedTests.class,// + DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.class,// + DefaultLoaderExplicitConfigClassesBaseTests.class,// + DefaultLoaderExplicitConfigClassesInheritedTests.class,// + DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.class // }) public class AnnotationConfigTestSuite { } diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java index 3bd2fea8ae18..61a033f3cb94 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java @@ -29,8 +29,8 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. * - * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTestsConfig} - * and {@link BeanOverridingDefaultConfigClassesInheritedTestsConfig}. + * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration} + * and {@link BeanOverridingDefaultConfigClassesInheritedTests.ContextConfiguration}. * * @author Sam Brannen * @since 3.1 diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingExplicitConfigClassesInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingExplicitConfigClassesInheritedTests.java index c0cc2721d03f..537e46ead0e0 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingExplicitConfigClassesInheritedTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingExplicitConfigClassesInheritedTests.java @@ -26,8 +26,8 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. * - * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTestsConfig} - * and {@link BeanOverridingDefaultConfigClassesInheritedTestsConfig}. + * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration} + * and {@link BeanOverridingDefaultConfigClassesInheritedTests.ContextConfiguration}. * * @author Sam Brannen * @since 3.1 diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java index 046d95954b56..05c586dcd3a0 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java @@ -33,7 +33,7 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. * - * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTestsConfig}. + * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration}. * * @author Sam Brannen * @since 3.1 diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java index 6351e0c71d0e..281c8f3f266b 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java @@ -30,8 +30,8 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. * - * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTestsConfig} - * and {@link DefaultConfigClassesInheritedTestsConfig}. + * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration} + * and {@link DefaultConfigClassesInheritedTests.ContextConfiguration}. * * @author Sam Brannen * @since 3.1 diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java new file mode 100644 index 000000000000..c61562127f50 --- /dev/null +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java @@ -0,0 +1,62 @@ +/* + * Copyright 2002-2011 the original author or authors. + * + * 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.springframework.test.context.junit4.annotation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.springframework.beans.Employee; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.support.DelegatingSmartContextLoader; + +/** + * Integration tests that verify support for configuration classes in + * the Spring TestContext Framework in conjunction with the + * {@link DelegatingSmartContextLoader}. + * + * @author Sam Brannen + * @since 3.1 + */ +@ContextConfiguration +public class DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests extends + DefaultLoaderDefaultConfigClassesBaseTests { + + @Configuration + static class Config { + + @Bean + public Employee employee() { + Employee employee = new Employee(); + employee.setName("Yoda"); + employee.setAge(900); + employee.setCompany("The Force"); + return employee; + } + } + + + @Test + @Override + public void verifyEmployeeSetFromBaseContextConfig() { + assertNotNull("The employee should have been autowired.", this.employee); + assertEquals("The employee bean should have been overridden.", "Yoda", this.employee.getName()); + } + +} diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.java new file mode 100644 index 000000000000..cdf4207a0161 --- /dev/null +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.java @@ -0,0 +1,45 @@ +/* + * Copyright 2002-2011 the original author or authors. + * + * 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.springframework.test.context.junit4.annotation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.support.DelegatingSmartContextLoader; + +/** + * Integration tests that verify support for configuration classes in + * the Spring TestContext Framework in conjunction with the + * {@link DelegatingSmartContextLoader}. + * + * @author Sam Brannen + * @since 3.1 + */ +@ContextConfiguration(classes = DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.Config.class) +public class DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests extends + DefaultLoaderExplicitConfigClassesBaseTests { + + @Test + @Override + public void verifyEmployeeSetFromBaseContextConfig() { + assertNotNull("The employee should have been autowired.", this.employee); + assertEquals("The employee bean should have been overridden.", "Yoda", this.employee.getName()); + } + +} diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java new file mode 100644 index 000000000000..dcc5249163c6 --- /dev/null +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java @@ -0,0 +1,68 @@ +/* + * Copyright 2002-2011 the original author or authors. + * + * 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.springframework.test.context.junit4.annotation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.Employee; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DelegatingSmartContextLoader; + +/** + * Integration tests that verify support for configuration classes in + * the Spring TestContext Framework in conjunction with the + * {@link DelegatingSmartContextLoader}. + * + * @author Sam Brannen + * @since 3.1 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration +public class DefaultLoaderDefaultConfigClassesBaseTests { + + @Configuration + static class Config { + + @Bean + public Employee employee() { + Employee employee = new Employee(); + employee.setName("John Smith"); + employee.setAge(42); + employee.setCompany("Acme Widgets, Inc."); + return employee; + } + } + + + @Autowired + protected Employee employee; + + + @Test + public void verifyEmployeeSetFromBaseContextConfig() { + assertNotNull("The employee field should have been autowired.", this.employee); + assertEquals("John Smith", this.employee.getName()); + } + +} diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java new file mode 100644 index 000000000000..a5706a1517d6 --- /dev/null +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java @@ -0,0 +1,61 @@ +/* + * Copyright 2002-2011 the original author or authors. + * + * 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.springframework.test.context.junit4.annotation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.springframework.beans.Pet; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.support.DelegatingSmartContextLoader; + +/** + * Integration tests that verify support for configuration classes in + * the Spring TestContext Framework in conjunction with the + * {@link DelegatingSmartContextLoader}. + * + * @author Sam Brannen + * @since 3.1 + */ +@ContextConfiguration +public class DefaultLoaderDefaultConfigClassesInheritedTests extends DefaultLoaderDefaultConfigClassesBaseTests { + + @Configuration + static class Config { + + @Bean + public Pet pet() { + return new Pet("Fido"); + } + } + + + @Autowired + private Pet pet; + + + @Test + public void verifyPetSetFromExtendedContextConfig() { + assertNotNull("The pet should have been autowired.", this.pet); + assertEquals("Fido", this.pet.getName()); + } + +} diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java new file mode 100644 index 000000000000..46b72595814b --- /dev/null +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java @@ -0,0 +1,52 @@ +/* + * Copyright 2002-2011 the original author or authors. + * + * 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.springframework.test.context.junit4.annotation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.Employee; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DelegatingSmartContextLoader; + +/** + * Integration tests that verify support for configuration classes in + * the Spring TestContext Framework in conjunction with the + * {@link DelegatingSmartContextLoader}. + * + * @author Sam Brannen + * @since 3.1 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = DefaultLoaderDefaultConfigClassesBaseTests.Config.class) +public class DefaultLoaderExplicitConfigClassesBaseTests { + + @Autowired + protected Employee employee; + + + @Test + public void verifyEmployeeSetFromBaseContextConfig() { + assertNotNull("The employee should have been autowired.", this.employee); + assertEquals("John Smith", this.employee.getName()); + } + +} diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java new file mode 100644 index 000000000000..69a2c846b53d --- /dev/null +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java @@ -0,0 +1,52 @@ +/* + * Copyright 2002-2011 the original author or authors. + * + * 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.springframework.test.context.junit4.annotation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.Pet; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DelegatingSmartContextLoader; + +/** + * Integration tests that verify support for configuration classes in + * the Spring TestContext Framework in conjunction with the + * {@link DelegatingSmartContextLoader}. + * + * @author Sam Brannen + * @since 3.1 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = DefaultLoaderDefaultConfigClassesInheritedTests.Config.class) +public class DefaultLoaderExplicitConfigClassesInheritedTests extends DefaultLoaderExplicitConfigClassesBaseTests { + + @Autowired + private Pet pet; + + + @Test + public void verifyPetSetFromExtendedContextConfig() { + assertNotNull("The pet should have been autowired.", this.pet); + assertEquals("Fido", this.pet.getName()); + } + +} diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java index e45bc3d03310..cd351bdfc01b 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java @@ -31,7 +31,7 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. * - * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTestsConfig}. + * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration}. * * @author Sam Brannen * @since 3.1 diff --git a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java index 21b19c31b266..642d2d67e75d 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java @@ -31,8 +31,8 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. * - * <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTestsConfig} - * and {@link DefaultConfigClassesInheritedTestsConfig} + * <p>Configuration will be loaded from {@link DefaultConfigClassesInheritedTests.ContextConfiguration} + * and {@link DefaultConfigClassesBaseTests.ContextConfiguration}. * * @author Sam Brannen * @since 3.1
52fe6310a02d23419c6adada88354fa068347dd8
kotlin
Fix breakpoints in inline functions in libraries--
c
https://github.com/JetBrains/kotlin
diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/JetPositionManager.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/JetPositionManager.kt index 8b26972d48623..073b0073c55c7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/JetPositionManager.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/JetPositionManager.kt @@ -48,6 +48,8 @@ import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils import org.jetbrains.kotlin.idea.decompiler.JetClsFile import org.jetbrains.kotlin.idea.findUsages.toSearchTarget import org.jetbrains.kotlin.idea.search.usagesSearch.DefaultSearchHelper +import org.jetbrains.kotlin.idea.search.usagesSearch.FunctionUsagesSearchHelper +import org.jetbrains.kotlin.idea.search.usagesSearch.UsagesSearch import org.jetbrains.kotlin.idea.search.usagesSearch.search import org.jetbrains.kotlin.idea.util.DebuggerUtils import org.jetbrains.kotlin.idea.util.application.runReadAction @@ -353,7 +355,10 @@ public class JetPositionManager(private val myDebugProcess: DebugProcess) : Mult } if (isInLibrary) { - val elementAtForLibraryFile = getElementToCreateTypeMapperForLibraryFile(notPositionedElement) + val elementAtForLibraryFile = + if (element is JetDeclaration) element + else PsiTreeUtil.getParentOfType(element, javaClass<JetDeclaration>()) + assert(elementAtForLibraryFile != null) { "Couldn't find element at breakpoint for library file " + file.getName() + (if (notPositionedElement == null) "" else ", notPositionedElement = " + notPositionedElement.getElementTextWithContext()) @@ -430,9 +435,11 @@ public class JetPositionManager(private val myDebugProcess: DebugProcess) : Mult InlineUtil.isInline(typeMapper.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, psiElement)) ) { val project = myDebugProcess.getProject() - val usagesSearchTarget = FindUsagesOptions(project).toSearchTarget(psiElement, true) + val options = FindUsagesOptions(project) + options.isSearchForTextOccurrences = false + val usagesSearchTarget = options.toSearchTarget(psiElement, true) - val usagesSearchRequest = DefaultSearchHelper<JetNamedFunction>(true).newRequest(usagesSearchTarget) + val usagesSearchRequest = FunctionUsagesSearchHelper(skipImports = true).newRequest(usagesSearchTarget) usagesSearchRequest.search().forEach { val psiElement = it.getElement() if (psiElement is JetElement) { diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/PositionManagerLibraryClassFileSearcher.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/PositionManagerLibraryClassFileSearcher.kt index ceace2ba737b0..ab7d0c3e7e890 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/PositionManagerLibraryClassFileSearcher.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/PositionManagerLibraryClassFileSearcher.kt @@ -51,13 +51,7 @@ private val LOG = Logger.getInstance("org.jetbrains.kotlin.idea.debugger") * 2. find all descriptors with same signature, if there is one - return it * 3. else -> return null, because it means that there is more than one function with same signature in project */ -fun findPackagePartInternalNameForLibraryFile(elementAt: JetElement): String? { - val topLevelDeclaration = PsiTreeUtil.getTopmostParentOfType(elementAt, javaClass<JetDeclaration>()) - if (topLevelDeclaration == null) { - reportError(elementAt, null) - return null - } - +fun findPackagePartInternalNameForLibraryFile(topLevelDeclaration: JetDeclaration): String? { val packagePartFile = findPackagePartFileNamesForElement(topLevelDeclaration).singleOrNull() if (packagePartFile != null) return packagePartFile diff --git a/idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java b/idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java index e88ea3ce09a1e..58add37c3ab53 100644 --- a/idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java +++ b/idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java @@ -99,7 +99,7 @@ public Boolean invoke(JetFile file) { public Boolean invoke(JetFile file) { Integer startLineOffset = CodeInsightUtils.getStartLineOffset(file, lineNumber); assert startLineOffset != null : "Cannot find start line offset for file " + file.getName() + ", line " + lineNumber; - JetElement elementAt = PsiTreeUtil.getParentOfType(file.findElementAt(startLineOffset), JetElement.class); + JetDeclaration elementAt = PsiTreeUtil.getParentOfType(file.findElementAt(startLineOffset), JetDeclaration.class); return elementAt != null && className.getInternalName().equals(DebuggerPackage.findPackagePartInternalNameForLibraryFile(elementAt)); } diff --git a/idea/testData/debugger/customLibraryForTinyApp/inlineFunInLibrary/inlineFunInLibrary.kt b/idea/testData/debugger/customLibraryForTinyApp/inlineFunInLibrary/inlineFunInLibrary.kt new file mode 100644 index 0000000000000..f5ef1ab10e7e3 --- /dev/null +++ b/idea/testData/debugger/customLibraryForTinyApp/inlineFunInLibrary/inlineFunInLibrary.kt @@ -0,0 +1,5 @@ +package customLib.inlineFunInLibrary + +public inline fun inlineFun(f: () -> Unit) { + 1 + 1 +} diff --git a/idea/testData/debugger/tinyApp/outs/breakpointInInlineFun.out b/idea/testData/debugger/tinyApp/outs/breakpointInInlineFun.out new file mode 100644 index 0000000000000..dcf05d1088e25 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/breakpointInInlineFun.out @@ -0,0 +1,7 @@ +LineBreakpoint created at inlineFunInLibrary.kt:3 +!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! breakpointInInlineFun.BreakpointInInlineFunPackage +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +inlineFunInLibrary.kt:4 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/breakpointInInlineFun.kt b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/breakpointInInlineFun.kt new file mode 100644 index 0000000000000..027b287037e81 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/breakpointInInlineFun.kt @@ -0,0 +1,9 @@ +package breakpointInInlineFun + +import customLib.inlineFunInLibrary.* + +fun main(args: Array<String>) { + inlineFun { } +} + +// ADDITIONAL_BREAKPOINT: inlineFunInLibrary.kt:public inline fun inlineFun \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java index 2bc965afdc23f..e23dc6ce26549 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java @@ -61,6 +61,12 @@ public void testBoxParam() throws Exception { doSingleBreakpointTest(fileName); } + @TestMetadata("breakpointInInlineFun.kt") + public void testBreakpointInInlineFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/breakpointInInlineFun.kt"); + doSingleBreakpointTest(fileName); + } + @TestMetadata("callableBug.kt") public void testCallableBug() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/callableBug.kt");
207f8e7c475fb8f4ac45baed88daa5d80c2a72b6
kotlin
Cleanup--
p
https://github.com/JetBrains/kotlin
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForPackageProvider.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForPackageProvider.java index db0ae9954084f..7ba8103cf9b0e 100644 --- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForPackageProvider.java +++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForPackageProvider.java @@ -58,15 +58,6 @@ public KotlinLightClassForPackageProvider(@NotNull Project project, @NotNull FqN public Result<PsiClass> compute() { checkForBuiltIns(); - PsiJavaFileStubImpl javaFileStub = new PsiJavaFileStubImpl(fqName.getFqName(), true); - - Stack<StubElement> stubStack = new Stack<StubElement>(); - - ClassBuilderFactory builderFactory = new KotlinLightClassBuilderFactory(stubStack); - - // The context must reflect _all files in the module_. not only the current file - // Otherwise, the analyzer gets confused and can't, for example, tell which files come as sources and which - // must be loaded from .class files LightClassConstructionContext context = LightClassGenerationSupport.getInstance(project).analyzeRelevantCode(files); Throwable error = context.getError(); @@ -74,7 +65,12 @@ public Result<PsiClass> compute() { throw new IllegalStateException("failed to analyze: " + error, error); } + PsiJavaFileStubImpl javaFileStub = new PsiJavaFileStubImpl(fqName.getFqName(), true); + try { + Stack<StubElement> stubStack = new Stack<StubElement>(); + ClassBuilderFactory builderFactory = new KotlinLightClassBuilderFactory(stubStack); + GenerationState state = new GenerationState( project, builderFactory,
381ccde48d11ef82c371789898e563233141b7ee
spring-framework
IdToEntityConverter defensively handles access to- getDeclaredMethods--Issue: SPR-11758-
c
https://github.com/spring-projects/spring-framework
diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/IdToEntityConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/IdToEntityConverter.java index e80bd599cdfa..35f1d22350bc 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/IdToEntityConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/IdToEntityConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,20 +31,23 @@ * Converts an entity identifier to a entity reference by calling a static finder method * on the target entity type. * - * <p>For this converter to match, the finder method must be public, static, have the signature + * <p>For this converter to match, the finder method must be static, have the signature * {@code find[EntityName]([IdType])}, and return an instance of the desired entity type. * * @author Keith Donald + * @author Juergen Hoeller * @since 3.0 */ final class IdToEntityConverter implements ConditionalGenericConverter { private final ConversionService conversionService; + public IdToEntityConverter(ConversionService conversionService) { this.conversionService = conversionService; } + @Override public Set<ConvertiblePair> getConvertibleTypes() { return Collections.singleton(new ConvertiblePair(Object.class, Object.class)); @@ -53,7 +56,8 @@ public Set<ConvertiblePair> getConvertibleTypes() { @Override public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { Method finder = getFinder(targetType.getType()); - return finder != null && this.conversionService.canConvert(sourceType, TypeDescriptor.valueOf(finder.getParameterTypes()[0])); + return (finder != null && + this.conversionService.canConvert(sourceType, TypeDescriptor.valueOf(finder.getParameterTypes()[0]))); } @Override @@ -62,18 +66,31 @@ public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor t return null; } Method finder = getFinder(targetType.getType()); - Object id = this.conversionService.convert(source, sourceType, TypeDescriptor.valueOf(finder.getParameterTypes()[0])); + Object id = this.conversionService.convert( + source, sourceType, TypeDescriptor.valueOf(finder.getParameterTypes()[0])); return ReflectionUtils.invokeMethod(finder, source, id); } + private Method getFinder(Class<?> entityClass) { String finderMethod = "find" + getEntityName(entityClass); - Method[] methods = entityClass.getDeclaredMethods(); + Method[] methods; + boolean localOnlyFiltered; + try { + methods = entityClass.getDeclaredMethods(); + localOnlyFiltered = true; + } + catch (SecurityException ex) { + // Not allowed to access non-public methods... + // Fallback: check locally declared public methods only. + methods = entityClass.getMethods(); + localOnlyFiltered = false; + } for (Method method : methods) { - if (Modifier.isStatic(method.getModifiers()) && method.getParameterTypes().length == 1 && method.getReturnType().equals(entityClass)) { - if (method.getName().equals(finderMethod)) { - return method; - } + if (Modifier.isStatic(method.getModifiers()) && method.getName().equals(finderMethod) && + method.getParameterTypes().length == 1 && method.getReturnType().equals(entityClass) && + (localOnlyFiltered || method.getDeclaringClass().equals(entityClass))) { + return method; } } return null;
e86d48730c64d10ba2a838e5663f9ab7a698c9c6
hadoop
HADOOP-7187. Fix socket leak in GangliaContext. - Contributed by Uma Maheswara Rao G--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1085122 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/hadoop
diff --git a/CHANGES.txt b/CHANGES.txt index 3cb5136879088..f33d02a834cbc 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -604,6 +604,9 @@ Release 0.21.1 - Unreleased HADOOP-7174. Null is displayed in the "fs -copyToLocal" command. (Uma Maheswara Rao G via szetszwo) + HADOOP-7187. Fix socket leak in GangliaContext. (Uma Maheswara Rao G + via szetszwo) + Release 0.21.0 - 2010-08-13 INCOMPATIBLE CHANGES diff --git a/src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java b/src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java index 1b22240f879d0..6460120012d41 100644 --- a/src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java +++ b/src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java @@ -112,6 +112,17 @@ public void init(String contextName, ContextFactory factory) { } } + /** + * method to close the datagram socket + */ + @Override + public void close() { + super.close(); + if (datagramSocket != null) { + datagramSocket.close(); + } + } + @InterfaceAudience.Private public void emitRecord(String contextName, String recordName, OutputRecord outRec) diff --git a/src/test/core/org/apache/hadoop/metrics/ganglia/TestGangliaContext.java b/src/test/core/org/apache/hadoop/metrics/ganglia/TestGangliaContext.java new file mode 100644 index 0000000000000..deb8231154cd8 --- /dev/null +++ b/src/test/core/org/apache/hadoop/metrics/ganglia/TestGangliaContext.java @@ -0,0 +1,42 @@ +/* + * TestGangliaContext.java + * + * 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.apache.hadoop.metrics.ganglia; + +import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.hadoop.metrics.ContextFactory; +import org.apache.hadoop.metrics.spi.AbstractMetricsContext; + +public class TestGangliaContext { + + @Test + public void testCloseShouldCloseTheSocketWhichIsCreatedByInit() throws Exception { + AbstractMetricsContext context=new GangliaContext(); + context.init("gangliaContext", ContextFactory.getFactory()); + GangliaContext gangliaContext =(GangliaContext) context; + assertFalse("Socket already closed",gangliaContext.datagramSocket.isClosed()); + context.close(); + assertTrue("Socket not closed",gangliaContext.datagramSocket.isClosed()); + } +}
09c3edcbc7b12c62280eeba8bb3dea0f06775367
kotlin
'hasSyntaxErrors' check moved from Diagnostic to- PositioningStrategy--This makes possible to mark diagnostic errors when syntax error are present (by overriding isValid in PositioningStrategy subclasses).-
a
https://github.com/JetBrains/kotlin
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/AbstractDiagnostic.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/AbstractDiagnostic.java index 22f5a8fbb944d..ab26aa0d0ea02 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/AbstractDiagnostic.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/AbstractDiagnostic.java @@ -71,20 +71,7 @@ public List<TextRange> getTextRanges() { @Override public boolean isValid() { if (!getFactory().isValid(this)) return false; - if (hasSyntaxErrors(psiElement)) return false; if (psiElement.getNode().findChildByType(JetNodeTypes.IDE_TEMPLATE_EXPRESSION) != null) return false; return true; } - - private static boolean hasSyntaxErrors(@NotNull PsiElement psiElement) { - if (psiElement instanceof PsiErrorElement) return true; - - PsiElement lastChild = psiElement.getLastChild(); - if (lastChild != null && hasSyntaxErrors(lastChild)) return true; - - PsiElement[] children = psiElement.getChildren(); - if (children.length > 0 && hasSyntaxErrors(children[children.length - 1])) return true; - - return false; - } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/PositioningStrategies.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/PositioningStrategies.java index d49d8a2daad25..d7abf9cf9cb36 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/PositioningStrategies.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/PositioningStrategies.java @@ -139,7 +139,7 @@ else if (element instanceof JetClass) { } @Override public boolean isValid(@NotNull PsiNameIdentifierOwner element) { - return element.getNameIdentifier() != null; + return element.getNameIdentifier() != null && super.isValid(element); } }; @@ -299,6 +299,8 @@ public List<TextRange> mark(@NotNull JetDeclarationWithBody element) { @Override public boolean isValid(@NotNull JetDeclarationWithBody element) { + if (!super.isValid(element)) return false; + JetExpression bodyExpression = element.getBodyExpression(); if (!(bodyExpression instanceof JetBlockExpression)) return false; if (((JetBlockExpression) bodyExpression).getLastBracketRange() == null) return false; diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/PositioningStrategy.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/PositioningStrategy.java index f2dcf999f6b4f..4e54884790a93 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/PositioningStrategy.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/PositioningStrategy.java @@ -32,7 +32,7 @@ public List<TextRange> mark(@NotNull E element) { } public boolean isValid(@NotNull E element) { - return true; + return !hasSyntaxErrors(element); } @NotNull @@ -49,4 +49,16 @@ protected static List<TextRange> markNode(@NotNull ASTNode node) { protected static List<TextRange> markRange(@NotNull TextRange range) { return Collections.singletonList(range); } + + protected static boolean hasSyntaxErrors(@NotNull PsiElement psiElement) { + if (psiElement instanceof PsiErrorElement) return true; + + PsiElement lastChild = psiElement.getLastChild(); + if (lastChild != null && hasSyntaxErrors(lastChild)) return true; + + PsiElement[] children = psiElement.getChildren(); + if (children.length > 0 && hasSyntaxErrors(children[children.length - 1])) return true; + + return false; + } }
5ee76beeb417b9074068cd3a3b16f84d0c1b474e
camel
CAMEL-2339: Scheduled consumer now log- java.lang.Error at FATAL level before rethrowing--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@896858 13f79535-47bb-0310-9956-ffa450edef68-
p
https://github.com/apache/camel
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java index 9254857842e53..0fd0afbb33795 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java +++ b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java @@ -119,6 +119,10 @@ public void run() { } catch (Exception re) { throw ObjectHelper.wrapRuntimeCamelException(re); } + } catch (Error e) { + // log the fatal error as the JDK itself may not log it for us + log.fatal("Consumer " + this + " could not poll endpoint: " + getEndpoint().getEndpointUri() + " caused by: " + e.getMessage(), e); + throw e; } } }
a2f8902b3a8569a1ebb4b4c87fab5a412cf4d389
spring-framework
Inlined AntPathStringMatcher into AntPathMatcher--Also initializing the capacity of the AntPathStringMatcher cache to 256 now.-
p
https://github.com/spring-projects/spring-framework
diff --git a/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java b/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java index dd69dee00418..059c9f7a10c4 100644 --- a/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java +++ b/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java @@ -18,6 +18,8 @@ import java.util.Comparator; import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Matcher; @@ -43,6 +45,7 @@ * @author Juergen Hoeller * @author Rob Harrop * @author Arjen Poutsma + * @author Rossen Stoyanchev * @since 16.07.2003 */ public class AntPathMatcher implements PathMatcher { @@ -55,7 +58,7 @@ public class AntPathMatcher implements PathMatcher { private String pathSeparator = DEFAULT_PATH_SEPARATOR; private final Map<String, AntPathStringMatcher> stringMatcherCache = - new ConcurrentHashMap<String, AntPathStringMatcher>(); + new ConcurrentHashMap<String, AntPathStringMatcher>(256); /** Set the path separator to use for pattern parsing. Default is "/", as in Ant. */ @@ -213,8 +216,9 @@ else if (!fullMatch && "**".equals(pattDirs[pattIdxStart])) { } /** - * Tests whether or not a string matches against a pattern. The pattern may contain two special characters:<br> '*' - * means zero or more characters<br> '?' means one and only one character + * Tests whether or not a string matches against a pattern. The pattern may contain two special characters: + * <br>'*' means zero or more characters + * <br>'?' means one and only one character * @param pattern pattern to match against. Must not be <code>null</code>. * @param str string which must be matched against the pattern. Must not be <code>null</code>. * @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise. @@ -462,4 +466,88 @@ private int getPatternLength(String pattern) { } } + + /** + * Tests whether or not a string matches against a pattern via a {@link Pattern}. + * <p>The pattern may contain special characters: '*' means zero or more characters; '?' means one and + * only one character; '{' and '}' indicate a URI template pattern. For example <tt>/users/{user}</tt>. + */ + private static class AntPathStringMatcher { + + private static final Pattern GLOB_PATTERN = Pattern.compile("\\?|\\*|\\{((?:\\{[^/]+?\\}|[^/{}]|\\\\[{}])+?)\\}"); + + private static final String DEFAULT_VARIABLE_PATTERN = "(.*)"; + + private final Pattern pattern; + + private final List<String> variableNames = new LinkedList<String>(); + + public AntPathStringMatcher(String pattern) { + StringBuilder patternBuilder = new StringBuilder(); + Matcher m = GLOB_PATTERN.matcher(pattern); + int end = 0; + while (m.find()) { + patternBuilder.append(quote(pattern, end, m.start())); + String match = m.group(); + if ("?".equals(match)) { + patternBuilder.append('.'); + } + else if ("*".equals(match)) { + patternBuilder.append(".*"); + } + else if (match.startsWith("{") && match.endsWith("}")) { + int colonIdx = match.indexOf(':'); + if (colonIdx == -1) { + patternBuilder.append(DEFAULT_VARIABLE_PATTERN); + this.variableNames.add(m.group(1)); + } + else { + String variablePattern = match.substring(colonIdx + 1, match.length() - 1); + patternBuilder.append('('); + patternBuilder.append(variablePattern); + patternBuilder.append(')'); + String variableName = match.substring(1, colonIdx); + this.variableNames.add(variableName); + } + } + end = m.end(); + } + patternBuilder.append(quote(pattern, end, pattern.length())); + this.pattern = Pattern.compile(patternBuilder.toString()); + } + + private String quote(String s, int start, int end) { + if (start == end) { + return ""; + } + return Pattern.quote(s.substring(start, end)); + } + + /** + * Main entry point. + * @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise. + */ + public boolean matchStrings(String str, Map<String, String> uriTemplateVariables) { + Matcher matcher = this.pattern.matcher(str); + if (matcher.matches()) { + if (uriTemplateVariables != null) { + // SPR-8455 + Assert.isTrue(this.variableNames.size() == matcher.groupCount(), + "The number of capturing groups in the pattern segment " + this.pattern + + " does not match the number of URI template variables it defines, which can occur if " + + " capturing groups are used in a URI template regex. Use non-capturing groups instead."); + for (int i = 1; i <= matcher.groupCount(); i++) { + String name = this.variableNames.get(i - 1); + String value = matcher.group(i); + uriTemplateVariables.put(name, value); + } + } + return true; + } + else { + return false; + } + } + } + } diff --git a/spring-core/src/main/java/org/springframework/util/AntPathStringMatcher.java b/spring-core/src/main/java/org/springframework/util/AntPathStringMatcher.java deleted file mode 100644 index 424b60930e21..000000000000 --- a/spring-core/src/main/java/org/springframework/util/AntPathStringMatcher.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2002-2012 the original author or authors. - * - * 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.springframework.util; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Package-protected helper class for {@link AntPathMatcher}. Tests whether or not a string matches against a pattern - * via a {@link Pattern}. - * - * <p>The pattern may contain special characters: '*' means zero or more characters; '?' means one and only one - * character; '{' and '}' indicate a URI template pattern. For example <tt>/users/{user}</tt>. - * - * @author Arjen Poutsma - * @author Rossen Stoyanchev - * @since 3.0 - */ -class AntPathStringMatcher { - - private static final Pattern GLOB_PATTERN = Pattern.compile("\\?|\\*|\\{((?:\\{[^/]+?\\}|[^/{}]|\\\\[{}])+?)\\}"); - - private static final String DEFAULT_VARIABLE_PATTERN = "(.*)"; - - private final Pattern pattern; - - private final List<String> variableNames = new LinkedList<String>(); - - - /** Construct a new instance of the <code>AntPatchStringMatcher</code>. */ - AntPathStringMatcher(String pattern) { - this.pattern = createPattern(pattern); - } - - private Pattern createPattern(String pattern) { - StringBuilder patternBuilder = new StringBuilder(); - Matcher m = GLOB_PATTERN.matcher(pattern); - int end = 0; - while (m.find()) { - patternBuilder.append(quote(pattern, end, m.start())); - String match = m.group(); - if ("?".equals(match)) { - patternBuilder.append('.'); - } - else if ("*".equals(match)) { - patternBuilder.append(".*"); - } - else if (match.startsWith("{") && match.endsWith("}")) { - int colonIdx = match.indexOf(':'); - if (colonIdx == -1) { - patternBuilder.append(DEFAULT_VARIABLE_PATTERN); - variableNames.add(m.group(1)); - } - else { - String variablePattern = match.substring(colonIdx + 1, match.length() - 1); - patternBuilder.append('('); - patternBuilder.append(variablePattern); - patternBuilder.append(')'); - String variableName = match.substring(1, colonIdx); - variableNames.add(variableName); - } - } - end = m.end(); - } - patternBuilder.append(quote(pattern, end, pattern.length())); - return Pattern.compile(patternBuilder.toString()); - } - - private String quote(String s, int start, int end) { - if (start == end) { - return ""; - } - return Pattern.quote(s.substring(start, end)); - } - - /** - * Main entry point. - * - * @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise. - */ - public boolean matchStrings(String str, Map<String, String> uriTemplateVariables) { - Matcher matcher = pattern.matcher(str); - if (matcher.matches()) { - if (uriTemplateVariables != null) { - // SPR-8455 - Assert.isTrue(variableNames.size() == matcher.groupCount(), - "The number of capturing groups in the pattern segment " + pattern + - " does not match the number of URI template variables it defines, which can occur if " + - " capturing groups are used in a URI template regex. Use non-capturing groups instead."); - for (int i = 1; i <= matcher.groupCount(); i++) { - String name = this.variableNames.get(i - 1); - String value = matcher.group(i); - uriTemplateVariables.put(name, value); - } - } - return true; - } - else { - return false; - } - } - -}
1a86e8349193dfd3504507a4493265dd8b99c9df
restlet-framework-java
Indexed directories were not properly handled with- the CLAP protocol. Reported by Rob Heittman.--
c
https://github.com/restlet/restlet-framework-java
diff --git a/modules/com.noelios.restlet/src/com/noelios/restlet/local/ClapClientHelper.java b/modules/com.noelios.restlet/src/com/noelios/restlet/local/ClapClientHelper.java index a03a63d982..4664d3fe88 100644 --- a/modules/com.noelios.restlet/src/com/noelios/restlet/local/ClapClientHelper.java +++ b/modules/com.noelios.restlet/src/com/noelios/restlet/local/ClapClientHelper.java @@ -125,7 +125,7 @@ protected void handleClassLoader(Request request, Response response, URL url = classLoader.getResource(Reference.decode(path)); // The ClassLoader returns a directory listing in some cases. - // As this listing is partial, is it of little value in the context + // As this listing is partial, it is of little value in the context // of the CLAP client, so we have to ignore them. if (url != null) { if (url.getProtocol().equals("file")) { diff --git a/modules/com.noelios.restlet/src/com/noelios/restlet/local/DirectoryResource.java b/modules/com.noelios.restlet/src/com/noelios/restlet/local/DirectoryResource.java index bb2842c6ca..cdbccf6174 100644 --- a/modules/com.noelios.restlet/src/com/noelios/restlet/local/DirectoryResource.java +++ b/modules/com.noelios.restlet/src/com/noelios/restlet/local/DirectoryResource.java @@ -175,7 +175,8 @@ && getDirectory().getIndexName().length() > 0) { // Let's try with the facultative index, in case the underlying // client connector does not handle directory listing. if (this.targetUri.endsWith("/")) { - // Append the index name + // In this case, the trailing "/" shows that the URIs must + // points to a directory if (getDirectory().getIndexName() != null && getDirectory().getIndexName().length() > 0) { this.directoryUri = this.targetUri; @@ -190,6 +191,25 @@ && getDirectory().getIndexName().length() > 0) { this.targetIndex = true; } } + } else { + // Try to determine if this target URI with no trailing "/" is a + // directory, in order to force the redirection. + // Append the index name + if (getDirectory().getIndexName() != null + && getDirectory().getIndexName().length() > 0) { + this.directoryUri = this.targetUri + "/"; + this.baseName = getDirectory().getIndexName(); + this.targetUri = this.directoryUri + this.baseName; + contextResponse = getClientDispatcher().get(this.targetUri); + if (contextResponse.getEntity() != null) { + this.targetDirectory = true; + this.directoryRedirection = true; + this.directoryContent = new ReferenceList(); + this.directoryContent + .add(new Reference(this.targetUri)); + this.targetIndex = true; + } + } } } diff --git a/modules/org.restlet.test/src/org/restlet/test/DirectoryTestCase.java b/modules/org.restlet.test/src/org/restlet/test/DirectoryTestCase.java index eaa0c1c50e..ca8f1f9776 100644 --- a/modules/org.restlet.test/src/org/restlet/test/DirectoryTestCase.java +++ b/modules/org.restlet.test/src/org/restlet/test/DirectoryTestCase.java @@ -198,9 +198,9 @@ private void testDirectory(MyApplication application, Directory directory, Method.DELETE, null, "6c-1"); assertTrue(response.getStatus() .equals(Status.REDIRECTION_SEE_OTHER)); - System.out.println(response.getRedirectRef()); - response = handle(application, response.getRedirectRef().getPath(), - response.getRedirectRef().getPath(), Method.DELETE, null, + System.out.println(response.getLocationRef()); + response = handle(application, response.getLocationRef().getPath(), + response.getLocationRef().getPath(), Method.DELETE, null, "6c-2"); assertTrue(response.getStatus().equals( Status.CLIENT_ERROR_FORBIDDEN));
e25dcdd6b12a965b6eca0c69c847fd0316b1c455
camel
CAMEL-1255: Fixed missing classes in .jar - osgi- export stuff--git-svn-id: https://svn.apache.org/repos/asf/activemq/camel/trunk@734408 13f79535-47bb-0310-9956-ffa450edef68-
c
https://github.com/apache/camel
diff --git a/components/camel-jpa/pom.xml b/components/camel-jpa/pom.xml index 4f1fdbc49b782..a2a513db7aa56 100644 --- a/components/camel-jpa/pom.xml +++ b/components/camel-jpa/pom.xml @@ -35,8 +35,9 @@ <properties> <camel.osgi.export.pkg>org.apache.camel.component.jpa.*, - org.apache.camel.processor.idempotent.jpa.* - org.apache.camel.processor.interceptor.*</camel.osgi.export.pkg> + org.apache.camel.processor.idempotent.jpa.*, + org.apache.camel.processor.interceptor.* + </camel.osgi.export.pkg> </properties> <dependencies> diff --git a/components/camel-jpa/src/main/java/org/apache/camel/processor/interceptor/JpaTraceEventMessage.java b/components/camel-jpa/src/main/java/org/apache/camel/processor/interceptor/JpaTraceEventMessage.java index 504079977c49b..bf6b0b1058f9e 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/processor/interceptor/JpaTraceEventMessage.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/processor/interceptor/JpaTraceEventMessage.java @@ -175,7 +175,7 @@ public void setCausedByException(String causedByException) { @Override public String toString() { - return "TraceEventMessage[" + exchangeId + "] on node: " + toNode; + return "TraceEventMessage[" + getExchangeId() + "] on node: " + getToNode(); } } diff --git a/examples/camel-example-bam/README.txt b/examples/camel-example-bam/README.txt index e0af2baf529a7..cb7f6ceee0fe6 100644 --- a/examples/camel-example-bam/README.txt +++ b/examples/camel-example-bam/README.txt @@ -40,11 +40,10 @@ You can see the BAM activies defined in src/main/java/org/apache/camel/example/bam/MyActivites.java In the HSQL Database Explorer type - select * from activitystate + select * from camel_activitystate to see the states of the activities. Notice that one activity never receives its expected message and when it's overdue Camel reports this as an error. - To stop the example hit ctrl + c To use log4j as the logging framework add this to the pom.xml:
a035e9fd8a5bde10c26338d7b23f75dbf59f1352
drools
JBRULES-2121: JavaDialect isn't creating unique ids- - fixed name that is checked--git-svn-id: https://svn.jboss.org/repos/labs/labs/jbossrules/trunk@26929 c60d74c8-e8f6-0310-9e8f-d4a2fc68ab70-
c
https://github.com/kiegroup/drools
diff --git a/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java b/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java index 8d9bf344fe1..e6a9f723ae8 100644 --- a/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java +++ b/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java @@ -721,7 +721,7 @@ public static String getUniqueLegalName(final String packageName, counter++; final String fileName = packageName.replaceAll( "\\.", - "/" ) + newName + "_" + counter + ext; + "/" ) + "/" + newName + "_" + counter + "." + ext; //MVEL:test null to Fix failing test on org.drools.rule.builder.dialect.mvel.MVELConsequenceBuilderTest.testImperativeCodeError() exists = src != null && src.isAvailable( fileName );
a0b240db548102de8ecaf7e7ee27cd0010557b7d
hbase
HBASE-9287 TestCatalogTracker depends on the- execution order--git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1516292 13f79535-47bb-0310-9956-ffa450edef68-
p
https://github.com/apache/hbase
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java index 8163ea8a3b49..558549836808 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java @@ -103,6 +103,17 @@ public boolean isAborted() { } @After public void after() { + try { + // Clean out meta location or later tests will be confused... they presume + // start fresh in zk. + MetaRegionTracker.deleteMetaLocation(this.watcher); + } catch (KeeperException e) { + LOG.warn("Unable to delete META location", e); + } + + // Clear out our doctored connection or could mess up subsequent tests. + HConnectionManager.deleteConnection(UTIL.getConfiguration()); + this.watcher.close(); } @@ -124,14 +135,9 @@ private CatalogTracker constructAndStartCatalogTracker(final HConnection c) throws IOException, InterruptedException, KeeperException { HConnection connection = Mockito.mock(HConnection.class); constructAndStartCatalogTracker(connection); - try { - MetaRegionTracker.setMetaLocation(this.watcher, - new ServerName("example.com", 1234, System.currentTimeMillis())); - } finally { - // Clean out meta location or later tests will be confused... they presume - // start fresh in zk. - MetaRegionTracker.deleteMetaLocation(this.watcher); - } + + MetaRegionTracker.setMetaLocation(this.watcher, + new ServerName("example.com", 1234, System.currentTimeMillis())); } /** @@ -145,33 +151,30 @@ private CatalogTracker constructAndStartCatalogTracker(final HConnection c) final ClientProtos.ClientService.BlockingInterface client = Mockito.mock(ClientProtos.ClientService.BlockingInterface.class); HConnection connection = mockConnection(null, client); - try { - Mockito.when(client.get((RpcController)Mockito.any(), (GetRequest)Mockito.any())). - thenReturn(GetResponse.newBuilder().build()); - final CatalogTracker ct = constructAndStartCatalogTracker(connection); - ServerName meta = ct.getMetaLocation(); - Assert.assertNull(meta); - Thread t = new Thread() { - @Override - public void run() { - try { - ct.waitForMeta(); - } catch (InterruptedException e) { - throw new RuntimeException("Interrupted", e); - } + + Mockito.when(client.get((RpcController)Mockito.any(), (GetRequest)Mockito.any())). + thenReturn(GetResponse.newBuilder().build()); + final CatalogTracker ct = constructAndStartCatalogTracker(connection); + ServerName meta = ct.getMetaLocation(); + Assert.assertNull(meta); + Thread t = new Thread() { + @Override + public void run() { + try { + ct.waitForMeta(); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted", e); } - }; - t.start(); - while (!t.isAlive()) - Threads.sleep(1); + } + }; + t.start(); + while (!t.isAlive()) Threads.sleep(1); - assertTrue(t.isAlive()); - ct.stop(); - // Join the thread... should exit shortly. - t.join(); - } finally { - HConnectionManager.deleteConnection(UTIL.getConfiguration()); - } + Threads.sleep(1); + assertTrue(t.isAlive()); + ct.stop(); + // Join the thread... should exit shortly. + t.join(); } private void testVerifyMetaRegionLocationWithException(Exception ex) @@ -180,26 +183,17 @@ private void testVerifyMetaRegionLocationWithException(Exception ex) final ClientProtos.ClientService.BlockingInterface implementation = Mockito.mock(ClientProtos.ClientService.BlockingInterface.class); HConnection connection = mockConnection(null, implementation); - try { - // If a 'get' is called on mocked interface, throw connection refused. - Mockito.when(implementation.get((RpcController) Mockito.any(), (GetRequest) Mockito.any())). - thenThrow(new ServiceException(ex)); - // Now start up the catalogtracker with our doctored Connection. - final CatalogTracker ct = constructAndStartCatalogTracker(connection); - try { - MetaRegionTracker.setMetaLocation(this.watcher, SN); - long timeout = UTIL.getConfiguration(). - getLong("hbase.catalog.verification.timeout", 1000); - Assert.assertFalse(ct.verifyMetaRegionLocation(timeout)); - } finally { - // Clean out meta location or later tests will be confused... they - // presume start fresh in zk. - MetaRegionTracker.deleteMetaLocation(this.watcher); - } - } finally { - // Clear out our doctored connection or could mess up subsequent tests. - HConnectionManager.deleteConnection(UTIL.getConfiguration()); - } + + // If a 'get' is called on mocked interface, throw connection refused. + Mockito.when(implementation.get((RpcController) Mockito.any(), (GetRequest) Mockito.any())). + thenThrow(new ServiceException(ex)); + // Now start up the catalogtracker with our doctored Connection. + final CatalogTracker ct = constructAndStartCatalogTracker(connection); + + MetaRegionTracker.setMetaLocation(this.watcher, SN); + long timeout = UTIL.getConfiguration(). + getLong("hbase.catalog.verification.timeout", 1000); + Assert.assertFalse(ct.verifyMetaRegionLocation(timeout)); } /** @@ -255,15 +249,10 @@ public void testVerifyMetaRegionLocationFails() Mockito.when(connection.getAdmin(Mockito.any(ServerName.class), Mockito.anyBoolean())). thenReturn(implementation); final CatalogTracker ct = constructAndStartCatalogTracker(connection); - try { - MetaRegionTracker.setMetaLocation(this.watcher, - new ServerName("example.com", 1234, System.currentTimeMillis())); - Assert.assertFalse(ct.verifyMetaRegionLocation(100)); - } finally { - // Clean out meta location or later tests will be confused... they presume - // start fresh in zk. - MetaRegionTracker.deleteMetaLocation(this.watcher); - } + + MetaRegionTracker.setMetaLocation(this.watcher, + new ServerName("example.com", 1234, System.currentTimeMillis())); + Assert.assertFalse(ct.verifyMetaRegionLocation(100)); } @Test (expected = NotAllMetaRegionsOnlineException.class)
11ceaccc20c2e820e4891c5264947a01ca040bf4
elasticsearch
Randomize node level setting per node not per- cluster--
p
https://github.com/elastic/elasticsearch
diff --git a/src/test/java/org/elasticsearch/gateway/fs/IndexGatewayTests.java b/src/test/java/org/elasticsearch/gateway/fs/IndexGatewayTests.java index ed6ebe32d605c..0ca78e105693f 100644 --- a/src/test/java/org/elasticsearch/gateway/fs/IndexGatewayTests.java +++ b/src/test/java/org/elasticsearch/gateway/fs/IndexGatewayTests.java @@ -70,7 +70,6 @@ protected Settings nodeSettings(int nodeOrdinal) { if (between(0, 5) == 0) { builder.put("gateway.fs.chunk_size", between(1, 100) + "kb"); } - builder.put("index.number_of_replicas", "1"); builder.put("index.number_of_shards", rarely() ? Integer.toString(between(2, 6)) : "1"); storeType = rarely() ? "ram" : "fs"; diff --git a/src/test/java/org/elasticsearch/test/TestCluster.java b/src/test/java/org/elasticsearch/test/TestCluster.java index 6509ba74fcbfe..598c2b5ad01ab 100644 --- a/src/test/java/org/elasticsearch/test/TestCluster.java +++ b/src/test/java/org/elasticsearch/test/TestCluster.java @@ -150,21 +150,8 @@ public TestCluster(long clusterSeed, int numNodes, String clusterName) { sharedNodesSeeds[i] = random.nextLong(); } logger.info("Setup TestCluster [{}] with seed [{}] using [{}] nodes", clusterName, SeedUtils.formatSeed(clusterSeed), numSharedNodes); - Builder builder = ImmutableSettings.settingsBuilder() - /* use RAM directories in 10% of the runs */ -// .put("index.store.type", random.nextInt(10) == 0 ? MockRamIndexStoreModule.class.getName() : MockFSIndexStoreModule.class.getName()) - .put("index.store.type", MockFSIndexStoreModule.class.getName()) // no RAM dir for now! - .put(IndexEngineModule.EngineSettings.ENGINE_TYPE, MockEngineModule.class.getName()) - .put("cluster.name", clusterName) - // decrease the routing schedule so new nodes will be added quickly - some random value between 30 and 80 ms - .put("cluster.routing.schedule", (30 + random.nextInt(50)) + "ms") - // default to non gateway - .put("gateway.type", "none"); - if (isLocalTransportConfigured()) { - builder.put(TransportModule.TRANSPORT_TYPE_KEY, AssertingLocalTransportModule.class.getName()); - } else { - builder.put(Transport.TransportSettings.TRANSPORT_TCP_COMPRESS, random.nextInt(10) == 0); - } + this.nodeSettingsSource = nodeSettingsSource; + Builder builder = ImmutableSettings.settingsBuilder(); // randomize (multi/single) data path, special case for 0, don't set it at all... int numOfDataPaths = random.nextInt(5); if (numOfDataPaths > 0) { @@ -174,10 +161,8 @@ public TestCluster(long clusterSeed, int numNodes, String clusterName) { } builder.put("path.data", dataPath.toString()); } - builder.put("type", CacheRecycler.Type.values()[random.nextInt(CacheRecycler.Type.values().length)]); + defaultSettings = builder.build(); - this.defaultSettings = builder.build(); - this.nodeSettingsSource = nodeSettingsSource; } private static boolean isLocalTransportConfigured() { @@ -187,8 +172,9 @@ private static boolean isLocalTransportConfigured() { return Boolean.parseBoolean(System.getProperty("es.node.local", "false")); } - private Settings getSettings(int nodeOrdinal, Settings others) { - Builder builder = ImmutableSettings.settingsBuilder().put(defaultSettings); + private Settings getSettings(int nodeOrdinal, long nodeSeed, Settings others) { + Builder builder = ImmutableSettings.settingsBuilder().put(defaultSettings) + .put(getRandomNodeSettings(nodeSeed, clusterName)); Settings settings = nodeSettingsSource.settings(nodeOrdinal); if (settings != null) { builder.put(settings); @@ -199,6 +185,27 @@ private Settings getSettings(int nodeOrdinal, Settings others) { return builder.build(); } + private static Settings getRandomNodeSettings(long seed, String clusterName) { + Random random = new Random(seed); + Builder builder = ImmutableSettings.settingsBuilder() + /* use RAM directories in 10% of the runs */ + //.put("index.store.type", random.nextInt(10) == 0 ? MockRamIndexStoreModule.class.getName() : MockFSIndexStoreModule.class.getName()) + .put("index.store.type", MockFSIndexStoreModule.class.getName()) // no RAM dir for now! + .put(IndexEngineModule.EngineSettings.ENGINE_TYPE, MockEngineModule.class.getName()) + .put("cluster.name", clusterName) + // decrease the routing schedule so new nodes will be added quickly - some random value between 30 and 80 ms + .put("cluster.routing.schedule", (30 + random.nextInt(50)) + "ms") + // default to non gateway + .put("gateway.type", "none"); + if (isLocalTransportConfigured()) { + builder.put(TransportModule.TRANSPORT_TYPE_KEY, AssertingLocalTransportModule.class.getName()); + } else { + builder.put(Transport.TransportSettings.TRANSPORT_TCP_COMPRESS, random.nextInt(10) == 0); + } + builder.put("type", CacheRecycler.Type.values()[random.nextInt(CacheRecycler.Type.values().length)]); + return builder.build(); + } + public static String clusterName(String prefix, String childVMId, long clusterSeed) { StringBuilder builder = new StringBuilder(prefix); builder.append('-').append(NetworkUtils.getLocalAddress().getHostName()); @@ -298,7 +305,7 @@ private NodeAndClient buildNode() { private NodeAndClient buildNode(int nodeId, long seed, Settings settings) { ensureOpen(); - settings = getSettings(nodeId, settings); + settings = getSettings(nodeId, seed, settings); String name = buildNodeName(nodeId); assert !nodes.containsKey(name); Settings finalSettings = settingsBuilder() @@ -616,7 +623,7 @@ private synchronized void reset(Random random, boolean wipeData, double transpor NodeAndClient nodeAndClient = nodes.get(buildNodeName); if (nodeAndClient == null) { changed = true; - nodeAndClient = buildNode(i, sharedNodesSeeds[i], defaultSettings); + nodeAndClient = buildNode(i, sharedNodesSeeds[i], null); nodeAndClient.node.start(); logger.info("Start Shared Node [{}] not shared", nodeAndClient.name); }
56031cb270834dea0d6e013641c582a3a56c33ff
kotlin
Control-Flow Analysis: Fix bug in finally-block- repetition in the presence of non-local returns -EA-65982 Fixed--
c
https://github.com/JetBrains/kotlin
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.java b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.java index 914604348544a..d9d30cb1ad74f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.java @@ -86,6 +86,10 @@ public Instruction resolveToInstruction() { public PseudocodeLabel copy(int newLabelIndex) { return new PseudocodeLabel("L" + newLabelIndex, "copy of " + name + ", " + comment); } + + public PseudocodeImpl getPseudocode() { + return PseudocodeImpl.this; + } } private final List<Instruction> mutableInstructionList = new ArrayList<Instruction>(); @@ -455,6 +459,8 @@ private Instruction getNextPosition(int currentPosition) { } public int repeatPart(@NotNull Label startLabel, @NotNull Label finishLabel, int labelCount) { + PseudocodeImpl originalPseudocode = ((PseudocodeLabel) startLabel).getPseudocode(); + Integer startIndex = ((PseudocodeLabel) startLabel).getTargetInstructionIndex(); assert startIndex != null; Integer finishIndex = ((PseudocodeLabel) finishLabel).getTargetInstructionIndex(); @@ -462,7 +468,7 @@ public int repeatPart(@NotNull Label startLabel, @NotNull Label finishLabel, int Map<Label, Label> originalToCopy = Maps.newLinkedHashMap(); Multimap<Instruction, Label> originalLabelsForInstruction = HashMultimap.create(); - for (PseudocodeLabel label : labels) { + for (PseudocodeLabel label : originalPseudocode.labels) { Integer index = label.getTargetInstructionIndex(); if (index == null) continue; //label is not bounded yet if (label == startLabel || label == finishLabel) continue; @@ -476,11 +482,13 @@ public int repeatPart(@NotNull Label startLabel, @NotNull Label finishLabel, int labels.add((PseudocodeLabel) label); } for (int index = startIndex; index < finishIndex; index++) { - Instruction originalInstruction = mutableInstructionList.get(index); + Instruction originalInstruction = originalPseudocode.mutableInstructionList.get(index); repeatLabelsBindingForInstruction(originalInstruction, originalToCopy, originalLabelsForInstruction); addInstruction(copyInstruction(originalInstruction, originalToCopy)); } - repeatLabelsBindingForInstruction(mutableInstructionList.get(finishIndex), originalToCopy, originalLabelsForInstruction); + repeatLabelsBindingForInstruction(originalPseudocode.mutableInstructionList.get(finishIndex), + originalToCopy, + originalLabelsForInstruction); return labelCount; } diff --git a/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.instructions b/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.instructions new file mode 100644 index 0000000000000..b7155a8026035 --- /dev/null +++ b/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.instructions @@ -0,0 +1,195 @@ +== let == +fun <T: Any, U> T.let(f: (T) -> U): U = f(this) +--------------------- +L0: + 1 <START> + v(f: (T) -> U) + magic[FAKE_INITIALIZER](f: (T) -> U) -> <v0> + w(f|<v0>) + r(f) -> <v1> + r(this) -> <v2> + mark(f(this)) + call(f(this), invoke|<v1>, <v2>) -> <v3> + ret(*|<v3>) L1 +L1: + <END> NEXT:[<SINK>] +error: + <ERROR> PREV:[] +sink: + <SINK> PREV:[<ERROR>, <END>] +===================== +== bar == +fun bar(): Int = 1 +--------------------- +L0: + 1 <START> + r(1) -> <v0> + ret(*|<v0>) L1 +L1: + <END> NEXT:[<SINK>] +error: + <ERROR> PREV:[] +sink: + <SINK> PREV:[<ERROR>, <END>] +===================== +== foo == +fun foo(n: Int): Int { + try { + if (n < 0) return 0 + n.let { return it } + } + finally { + for (i in 1..2) { } + return bar() + } +} +--------------------- +L0: + 1 <START> + v(n: Int) + magic[FAKE_INITIALIZER](n: Int) -> <v0> + w(n|<v0>) + 2 mark({ try { if (n < 0) return 0 n.let { return it } } finally { for (i in 1..2) { } return bar() } }) + mark(try { if (n < 0) return 0 n.let { return it } } finally { for (i in 1..2) { } return bar() }) + jmp?(L2) NEXT:[mark({ for (i in 1..2) { } return bar() }), mark({ if (n < 0) return 0 n.let { return it } })] + 3 mark({ if (n < 0) return 0 n.let { return it } }) + mark(if (n < 0) return 0) + r(n) -> <v1> PREV:[mark(if (n < 0) return 0), jmp(L15)] + r(0) -> <v2> + mark(n < 0) + call(n < 0, compareTo|<v1>, <v2>) -> <v3> + jf(L3|<v3>) NEXT:[read (Unit), r(0) -> <v4>] + r(0) -> <v4> +L4 [start finally]: + 4 mark({ for (i in 1..2) { } return bar() }) + 5 r(1) -> <v5> PREV:[mark({ for (i in 1..2) { } return bar() }), jmp?(L16)] + r(2) -> <v6> + mark(1..2) + call(1..2, rangeTo|<v5>, <v6>) -> <v7> + v(i) +L5 [loop entry point]: +L9 [condition entry point]: + jmp?(L6) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8>] PREV:[v(i), jmp(L5)] + magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8> + w(i|<v8>) + mark(for (i in 1..2) { }) +L7 [body entry point]: + 6 mark({ }) + read (Unit) + 5 jmp(L5) NEXT:[jmp?(L6)] +L6 [loop exit point]: +L8 [body exit point]: + read (Unit) PREV:[jmp?(L6)] + 4 mark(bar()) + call(bar(), bar) -> <v9> + ret(*|<v9>) L1 NEXT:[<END>] +L10 [finish finally]: +- 3 ret(*|<v4>) L1 NEXT:[<END>] PREV:[] +- jmp(L11) NEXT:[merge(if (n < 0) return 0|!<v11>) -> <v12>] PREV:[] +L3 [else branch]: + read (Unit) PREV:[jf(L3|<v3>)] +L11 ['if' expression result]: + merge(if (n < 0) return 0|!<v11>) -> <v12> + mark(n.let { return it }) + r(n) -> <v13> + mark({ return it }) + jmp?(L12) NEXT:[r({ return it }) -> <v14>, d({ return it })] + d({ return it }) NEXT:[<SINK>] +L12 [after local declaration]: + r({ return it }) -> <v14> PREV:[jmp?(L12)] + mark(let { return it }) + call(let { return it }, let|<v13>, <v14>) -> <v15> + 2 jmp(L20) NEXT:[mark({ for (i in 1..2) { } return bar() })] +L2 [onExceptionToFinallyBlock]: + 4 mark({ for (i in 1..2) { } return bar() }) PREV:[jmp?(L2)] + 5 r(1) -> <v5> + r(2) -> <v6> + mark(1..2) + call(1..2, rangeTo|<v5>, <v6>) -> <v7> + v(i) +L21 [copy of L5, loop entry point]: +L25 [copy of L9, condition entry point]: + jmp?(L22) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8>] PREV:[v(i), jmp(L21)] + magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8> + w(i|<v8>) + mark(for (i in 1..2) { }) +L23 [copy of L7, body entry point]: + 6 mark({ }) + read (Unit) + 5 jmp(L21) NEXT:[jmp?(L22)] +L22 [copy of L6, loop exit point]: +L24 [copy of L8, body exit point]: + read (Unit) PREV:[jmp?(L22)] + 4 mark(bar()) + call(bar(), bar) -> <v9> + ret(*|<v9>) L1 NEXT:[<END>] +- 2 jmp(error) NEXT:[<ERROR>] PREV:[] +L20 [skipFinallyToErrorBlock]: + 4 mark({ for (i in 1..2) { } return bar() }) PREV:[jmp(L20)] + 5 r(1) -> <v5> + r(2) -> <v6> + mark(1..2) + call(1..2, rangeTo|<v5>, <v6>) -> <v7> + v(i) +L26 [copy of L5, loop entry point]: +L30 [copy of L9, condition entry point]: + jmp?(L27) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8>] PREV:[v(i), jmp(L26)] + magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8> + w(i|<v8>) + mark(for (i in 1..2) { }) +L28 [copy of L7, body entry point]: + 6 mark({ }) + read (Unit) + 5 jmp(L26) NEXT:[jmp?(L27)] +L27 [copy of L6, loop exit point]: +L29 [copy of L8, body exit point]: + read (Unit) PREV:[jmp?(L27)] + 4 mark(bar()) + call(bar(), bar) -> <v9> + ret(*|<v9>) L1 NEXT:[<END>] +- 2 merge(try { if (n < 0) return 0 n.let { return it } } finally { for (i in 1..2) { } return bar() }|<v15>) -> <v16> PREV:[] +L1: + 1 <END> NEXT:[<SINK>] PREV:[ret(*|<v9>) L1, ret(*|<v9>) L1, ret(*|<v9>) L1] +error: + <ERROR> PREV:[] +sink: + <SINK> PREV:[<ERROR>, <END>, d({ return it })] +===================== +== anonymous_0 == +{ return it } +--------------------- +L13: + 4 <START> + 5 mark(return it) + r(it) -> <v0> + 4 mark({ for (i in 1..2) { } return bar() }) + 5 r(1) -> <v5> + r(2) -> <v6> + mark(1..2) + call(1..2, rangeTo|<v5>, <v6>) -> <v7> + v(i) +L15 [copy of L5, loop entry point]: +L19 [copy of L9, condition entry point]: + jmp?(L16) NEXT:[r(1) -> <v5>, magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8>] + magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8> + w(i|<v8>) + mark(for (i in 1..2) { }) +L17 [copy of L7, body entry point]: + 6 mark({ }) + read (Unit) + 5 jmp(L15) NEXT:[r(n) -> <v1>] +L16 [copy of L6, loop exit point]: +L18 [copy of L8, body exit point]: +- read (Unit) PREV:[] +- 4 mark(bar()) PREV:[] +- call(bar(), bar) -> <v9> PREV:[] +- ret(*|<v9>) L1 NEXT:[<END>] PREV:[] +- 5 ret(*|<v0>) L1 NEXT:[<END>] PREV:[] +- 4 ret(*|!<v1>) L14 PREV:[] +L14: + <END> NEXT:[<SINK>] PREV:[] +error: + <ERROR> PREV:[] +sink: + <SINK> PREV:[<ERROR>, <END>] +===================== diff --git a/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.kt b/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.kt new file mode 100644 index 0000000000000..cc9c317762489 --- /dev/null +++ b/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.kt @@ -0,0 +1,14 @@ +fun <T: Any, U> T.let(f: (T) -> U): U = f(this) + +fun bar(): Int = 1 + +fun foo(n: Int): Int { + try { + if (n < 0) return 0 + n.let { return it } + } + finally { + for (i in 1..2) { } + return bar() + } +} \ No newline at end of file diff --git a/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.values b/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.values new file mode 100644 index 0000000000000..8419322f99671 --- /dev/null +++ b/compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.values @@ -0,0 +1,56 @@ +== let == +fun <T: Any, U> T.let(f: (T) -> U): U = f(this) +--------------------- + <v0>: {<: (T) -> U} NEW: magic[FAKE_INITIALIZER](f: (T) -> U) -> <v0> +f <v1>: {<: (T) -> U} NEW: r(f) -> <v1> +this <v2>: {<: T} COPY +this <v2>: {<: T} NEW: r(this) -> <v2> +f(this) <v3>: {<: U} NEW: call(f(this), invoke|<v1>, <v2>) -> <v3> +===================== +== bar == +fun bar(): Int = 1 +--------------------- +1 <v0>: Int NEW: r(1) -> <v0> +===================== +== foo == +fun foo(n: Int): Int { + try { + if (n < 0) return 0 + n.let { return it } + } + finally { + for (i in 1..2) { } + return bar() + } +} +--------------------- + <v0>: Int NEW: magic[FAKE_INITIALIZER](n: Int) -> <v0> + <v8>: Int NEW: magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8> +n <v1>: {<: Comparable<Int>} NEW: r(n) -> <v1> +0 <v2>: Int NEW: r(0) -> <v2> +n < 0 <v3>: Boolean NEW: call(n < 0, compareTo|<v1>, <v2>) -> <v3> +0 <v4>: Int NEW: r(0) -> <v4> +return 0 !<v11>: * +if (n < 0) return 0 <v12>: * NEW: merge(if (n < 0) return 0|!<v11>) -> <v12> +n <v13>: Int NEW: r(n) -> <v13> +{ return it } <v14>: {<: (Int) -> ???} NEW: r({ return it }) -> <v14> +let { return it } <v15>: * NEW: call(let { return it }, let|<v13>, <v14>) -> <v15> +n.let { return it } <v15>: * COPY +{ if (n < 0) return 0 n.let { return it } } <v15>: * COPY +1 <v5>: Int NEW: r(1) -> <v5> +2 <v6>: Int NEW: r(2) -> <v6> +1..2 <v7>: {<: Iterable<Int>} NEW: call(1..2, rangeTo|<v5>, <v6>) -> <v7> +bar() <v9>: Int NEW: call(bar(), bar) -> <v9> +return bar() !<v10>: * +{ for (i in 1..2) { } return bar() } !<v10>: * COPY +try { if (n < 0) return 0 n.let { return it } } finally { for (i in 1..2) { } return bar() } <v16>: * NEW: merge(try { if (n < 0) return 0 n.let { return it } } finally { for (i in 1..2) { } return bar() }|<v15>) -> <v16> +{ try { if (n < 0) return 0 n.let { return it } } finally { for (i in 1..2) { } return bar() } } <v16>: * COPY +===================== +== anonymous_0 == +{ return it } +--------------------- + <v8>: Int NEW: magic[LOOP_RANGE_ITERATION](1..2|<v7>) -> <v8> +it <v0>: Int NEW: r(it) -> <v0> +return it !<v1>: * +return it !<v1>: * COPY +===================== diff --git a/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java index 8107c01dce20e..f7d682edb221c 100644 --- a/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java @@ -204,6 +204,12 @@ public void testIf() throws Exception { doTest(fileName); } + @TestMetadata("localAndNonlocalReturnsWithFinally.kt") + public void testLocalAndNonlocalReturnsWithFinally() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.kt"); + doTest(fileName); + } + @TestMetadata("OnlyWhileInFunctionBody.kt") public void testOnlyWhileInFunctionBody() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/controlStructures/OnlyWhileInFunctionBody.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java index 889e304aa4146..fda6ae9a42026 100644 --- a/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java @@ -210,6 +210,12 @@ public void testIf() throws Exception { doTest(fileName); } + @TestMetadata("localAndNonlocalReturnsWithFinally.kt") + public void testLocalAndNonlocalReturnsWithFinally() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/controlStructures/localAndNonlocalReturnsWithFinally.kt"); + doTest(fileName); + } + @TestMetadata("OnlyWhileInFunctionBody.kt") public void testOnlyWhileInFunctionBody() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/controlStructures/OnlyWhileInFunctionBody.kt");
dcb491bdc8c5612f7ee5115c81312e8dc4f96709
orientdb
Fixed issue -3741--
c
https://github.com/orientechnologies/orientdb
diff --git a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedStorage.java b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedStorage.java index c596810c807..874e3818eec 100755 --- a/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedStorage.java +++ b/server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedStorage.java @@ -52,6 +52,7 @@ import com.orientechnologies.orient.core.metadata.schema.OClass; import com.orientechnologies.orient.core.metadata.schema.clusterselection.OClusterSelectionStrategy; import com.orientechnologies.orient.core.record.ORecord; +import com.orientechnologies.orient.core.record.ORecordInternal; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate; import com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect; @@ -909,6 +910,14 @@ public Object call() throws Exception { } } + + // RESET DIRTY FLAGS TO AVOID CALLING AUTO-SAVE + for (ORecordOperation op : tmpEntries) { + final ORecord record = op.getRecord(); + if (record != null) + ORecordInternal.unsetDirty(record); + } + } else if (result instanceof Throwable) { // EXCEPTION: LOG IT AND ADD AS NESTED EXCEPTION if (ODistributedServerLog.isDebugEnabled())
3ea0cf36bc778a46127c20d9d12da921baa237d7
spring-framework
Hibernate synchronization properly unbinds- Session even in case of afterCompletion exception (SPR-8757)--
c
https://github.com/spring-projects/spring-framework
diff --git a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SpringSessionSynchronization.java b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SpringSessionSynchronization.java index aab75ceb2024..240ebcbcc944 100644 --- a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SpringSessionSynchronization.java +++ b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SpringSessionSynchronization.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -218,32 +218,40 @@ public void afterCommit() { } public void afterCompletion(int status) { - if (!this.hibernateTransactionCompletion || !this.newSession) { - // No Hibernate TransactionManagerLookup: apply afterTransactionCompletion callback. - // Always perform explicit afterTransactionCompletion callback for pre-bound Session, - // even with Hibernate TransactionManagerLookup (which only applies to new Sessions). - Session session = this.sessionHolder.getSession(); - // Provide correct transaction status for releasing the Session's cache locks, - // if possible. Else, closing will release all cache locks assuming a rollback. - if (session instanceof SessionImplementor) { - ((SessionImplementor) session).afterTransactionCompletion(status == STATUS_COMMITTED, null); - } - // Close the Hibernate Session here if necessary - // (closed in beforeCompletion in case of TransactionManagerLookup). - if (this.newSession) { - SessionFactoryUtils.closeSessionOrRegisterDeferredClose(session, this.sessionFactory); + try { + if (!this.hibernateTransactionCompletion || !this.newSession) { + // No Hibernate TransactionManagerLookup: apply afterTransactionCompletion callback. + // Always perform explicit afterTransactionCompletion callback for pre-bound Session, + // even with Hibernate TransactionManagerLookup (which only applies to new Sessions). + Session session = this.sessionHolder.getSession(); + // Provide correct transaction status for releasing the Session's cache locks, + // if possible. Else, closing will release all cache locks assuming a rollback. + try { + if (session instanceof SessionImplementor) { + ((SessionImplementor) session).afterTransactionCompletion(status == STATUS_COMMITTED, null); + } + } + finally { + // Close the Hibernate Session here if necessary + // (closed in beforeCompletion in case of TransactionManagerLookup). + if (this.newSession) { + SessionFactoryUtils.closeSessionOrRegisterDeferredClose(session, this.sessionFactory); + } + else if (!this.hibernateTransactionCompletion) { + session.disconnect(); + } + } } - else if (!this.hibernateTransactionCompletion) { - session.disconnect(); + if (!this.newSession && status != STATUS_COMMITTED) { + // Clear all pending inserts/updates/deletes in the Session. + // Necessary for pre-bound Sessions, to avoid inconsistent state. + this.sessionHolder.getSession().clear(); } } - if (!this.newSession && status != STATUS_COMMITTED) { - // Clear all pending inserts/updates/deletes in the Session. - // Necessary for pre-bound Sessions, to avoid inconsistent state. - this.sessionHolder.getSession().clear(); - } - if (this.sessionHolder.doesNotHoldNonDefaultSession()) { - this.sessionHolder.setSynchronizedWithTransaction(false); + finally { + if (this.sessionHolder.doesNotHoldNonDefaultSession()) { + this.sessionHolder.setSynchronizedWithTransaction(false); + } } } diff --git a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate4/SpringSessionSynchronization.java b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate4/SpringSessionSynchronization.java index fa49ace3f743..19f47c86fc83 100644 --- a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate4/SpringSessionSynchronization.java +++ b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate4/SpringSessionSynchronization.java @@ -111,12 +111,16 @@ public void afterCommit() { } public void afterCompletion(int status) { - if (status != STATUS_COMMITTED) { - // Clear all pending inserts/updates/deletes in the Session. - // Necessary for pre-bound Sessions, to avoid inconsistent state. - this.sessionHolder.getSession().clear(); + try { + if (status != STATUS_COMMITTED) { + // Clear all pending inserts/updates/deletes in the Session. + // Necessary for pre-bound Sessions, to avoid inconsistent state. + this.sessionHolder.getSession().clear(); + } + } + finally { + this.sessionHolder.setSynchronizedWithTransaction(false); } - this.sessionHolder.setSynchronizedWithTransaction(false); } }
218ee6d24c991f841ee91085c2bb26d6198db8c6
spring-framework
added "boolean isRegisteredWithDestination()"- method (SPR-7065)--
a
https://github.com/spring-projects/spring-framework
diff --git a/org.springframework.jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java b/org.springframework.jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java index 3f608f086723..6ba4154e117c 100644 --- a/org.springframework.jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java +++ b/org.springframework.jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java @@ -178,6 +178,8 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe private int activeInvokerCount = 0; + private int registeredWithDestination = 0; + private Runnable stopCallback; private Object currentRecoveryMarker = new Object(); @@ -577,6 +579,27 @@ public final int getActiveConsumerCount() { } } + /** + * Return whether at lease one consumer has entered a fixed registration with the + * target destination. This is particularly interesting for the pub-sub case where + * it might be important to have an actual consumer registered that is guaranteed + * to not miss any messages that are just about to be published. + * <p>This method may be polled after a {@link #start()} call, until asynchronous + * registration of consumers has happened which is when the method will start returning + * <code>true</code> - provided that the listener container actually ever establishes + * a fixed registration. It will then keep returning <code>true</code> until shutdown, + * since the container will hold on to at least one consumer registration thereafter. + * <p>Note that a listener container is not bound to having a fixed registration in + * the first place. It may also keep recreating consumers for every invoker execution. + * This particularly depends on the {@link #setCacheLevel cache level} setting: + * Only CACHE_CONSUMER will lead to a fixed registration. + */ + public boolean isRegisteredWithDestination() { + synchronized (this.lifecycleMonitor) { + return (this.registeredWithDestination > 0); + } + } + /** * Create a default TaskExecutor. Called if no explicit TaskExecutor has been specified. @@ -1026,6 +1049,9 @@ private void initResourcesIfNecessary() throws JMSException { } if (this.consumer == null && getCacheLevel() >= CACHE_CONSUMER) { this.consumer = createListenerConsumer(this.session); + synchronized (lifecycleMonitor) { + registeredWithDestination++; + } } } } @@ -1047,6 +1073,11 @@ private void clearResources() { JmsUtils.closeMessageConsumer(this.consumer); JmsUtils.closeSession(this.session); } + if (this.consumer != null) { + synchronized (lifecycleMonitor) { + registeredWithDestination--; + } + } this.consumer = null; this.session = null; }
9521bc3d3eb5d1cc164417b9ca072393bb9cccda
hadoop
MAPREDUCE-3238. Small cleanup in SchedulerApp.- (Todd Lipcon via mahadev) - Merging r1206921 from trunk--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1206924 13f79535-47bb-0310-9956-ffa450edef68-
p
https://github.com/apache/hadoop
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 34252d944233d..c760640e179ad 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -56,6 +56,8 @@ Release 0.23.1 - Unreleased MAPREDUCE-3371. Review and improve the yarn-api javadocs. (Ravi Prakash via mahadev) + MAPREDUCE-3238. Small cleanup in SchedulerApp. (Todd Lipcon via mahadev) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java index 5ee6d46e95cbb..e3798c0defc15 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java @@ -53,6 +53,14 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerReservedEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Multiset; + +/** + * Represents an Application from the viewpoint of the scheduler. + * Each running Application in the RM corresponds to one instance + * of this class. + */ public class SchedulerApp { private static final Log LOG = LogFactory.getLog(SchedulerApp.class); @@ -76,11 +84,16 @@ public class SchedulerApp { final Map<Priority, Map<NodeId, RMContainer>> reservedContainers = new HashMap<Priority, Map<NodeId, RMContainer>>(); - Map<Priority, Integer> schedulingOpportunities = - new HashMap<Priority, Integer>(); + /** + * Count how many times the application has been given an opportunity + * to schedule a task at each priority. Each time the scheduler + * asks the application for a task at this priority, it is incremented, + * and each time the application successfully schedules a task, it + * is reset to 0. + */ + Multiset<Priority> schedulingOpportunities = HashMultiset.create(); - Map<Priority, Integer> reReservations = - new HashMap<Priority, Integer>(); + Multiset<Priority> reReservations = HashMultiset.create(); Resource currentReservation = recordFactory .newRecordInstance(Resource.class); @@ -282,49 +295,33 @@ public synchronized RMContainer getRMContainer(ContainerId id) { } synchronized public void resetSchedulingOpportunities(Priority priority) { - this.schedulingOpportunities.put(priority, Integer.valueOf(0)); + this.schedulingOpportunities.setCount(priority, 0); } synchronized public void addSchedulingOpportunity(Priority priority) { - Integer schedulingOpportunities = - this.schedulingOpportunities.get(priority); - if (schedulingOpportunities == null) { - schedulingOpportunities = 0; - } - ++schedulingOpportunities; - this.schedulingOpportunities.put(priority, schedulingOpportunities); + this.schedulingOpportunities.setCount(priority, + schedulingOpportunities.count(priority) + 1); } + /** + * Return the number of times the application has been given an opportunity + * to schedule a task at the given priority since the last time it + * successfully did so. + */ synchronized public int getSchedulingOpportunities(Priority priority) { - Integer schedulingOpportunities = - this.schedulingOpportunities.get(priority); - if (schedulingOpportunities == null) { - schedulingOpportunities = 0; - this.schedulingOpportunities.put(priority, schedulingOpportunities); - } - return schedulingOpportunities; + return this.schedulingOpportunities.count(priority); } synchronized void resetReReservations(Priority priority) { - this.reReservations.put(priority, Integer.valueOf(0)); + this.reReservations.setCount(priority, 0); } synchronized void addReReservation(Priority priority) { - Integer reReservations = this.reReservations.get(priority); - if (reReservations == null) { - reReservations = 0; - } - ++reReservations; - this.reReservations.put(priority, reReservations); + this.reReservations.add(priority); } synchronized public int getReReservations(Priority priority) { - Integer reReservations = this.reReservations.get(priority); - if (reReservations == null) { - reReservations = 0; - this.reReservations.put(priority, reReservations); - } - return reReservations; + return this.reReservations.count(priority); } public synchronized int getNumReservedContainers(Priority priority) {
910b45c395032fda3587998dcbfc15cf07e9a551
drools
[DROOLS-121] detect circular dependencies for- declared types--
c
https://github.com/kiegroup/drools
diff --git a/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilder.java b/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilder.java index 94654c8b30b..a17c203eaa7 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilder.java +++ b/drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilder.java @@ -3471,16 +3471,31 @@ public Collection<AbstractClassTypeDeclarationDescr> sortByHierarchy( List<Abstr taxonomy.put( name, new ArrayList<QualifiedName>() ); } else { this.results.add( new TypeDeclarationError( tdescr, - "Found duplicate declaration for type " + tdescr.getTypeName() ) ); + "Found duplicate declaration for type " + tdescr.getTypeName() ) ); } Collection<QualifiedName> supers = taxonomy.get( name ); - supers.addAll( tdescr.getSuperTypes() ); + boolean circular = false; + for ( QualifiedName sup : tdescr.getSuperTypes() ) { + if ( ! Object.class.getName().equals( name.getFullName() ) ) { + if ( ! hasCircularDependency( tdescr.getType(), sup, taxonomy ) ) { + supers.add( sup ); + } else { + circular = true; + this.results.add( new TypeDeclarationError( tdescr, + "Found circular dependency for type " + tdescr.getTypeName() ) ); + break; + } + } + } + if ( circular ) { + tdescr.getSuperTypes().clear(); + } for ( TypeFieldDescr field : tdescr.getFields().values() ) { QualifiedName typeName = new QualifiedName( field.getPattern().getObjectType() ); - if ( ! typeName.equals( name ) && ! hasCircularDependency( name, typeName, taxonomy ) ) { + if ( ! hasCircularDependency( name, typeName, taxonomy ) ) { supers.add( typeName ); } @@ -3497,8 +3512,20 @@ public Collection<AbstractClassTypeDeclarationDescr> sortByHierarchy( List<Abstr } private boolean hasCircularDependency( QualifiedName name, QualifiedName typeName, Map<QualifiedName, Collection<QualifiedName>> taxonomy) { + if ( name.equals( typeName ) ) { + return true; + } if ( taxonomy.containsKey( typeName ) ) { - return taxonomy.get( typeName ).contains( name ); + Collection<QualifiedName> parents = taxonomy.get( typeName ); + if ( parents.contains( name ) ) { + return true; + } else { + for ( QualifiedName ancestor : parents ) { + if ( hasCircularDependency( name, ancestor, taxonomy ) ) { + return true; + } + } + } } return false; } diff --git a/drools-compiler/src/test/java/org/drools/compiler/integrationtests/ExtendsTest.java b/drools-compiler/src/test/java/org/drools/compiler/integrationtests/ExtendsTest.java index 0a313f39e19..d5c7e2735fa 100644 --- a/drools-compiler/src/test/java/org/drools/compiler/integrationtests/ExtendsTest.java +++ b/drools-compiler/src/test/java/org/drools/compiler/integrationtests/ExtendsTest.java @@ -635,6 +635,45 @@ public void testInheritFromClassWithDefaults() throws Exception { } + @Test + public void testExtendSelf() throws Exception { + String s1 = "package org.drools;\n" + + "global java.util.List list;\n" + + "\n" + + "declare Bean extends Bean \n" + + " foo : int @key\n" + + "end\n"; + + KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(); + + KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder( ); + kBuilder.add( new ByteArrayResource( s1.getBytes() ), ResourceType.DRL ); + assertTrue( kBuilder.hasErrors() ); + } + @Test + public void testExtendCircular() throws Exception { + String s1 = "package org.drools;\n" + + "global java.util.List list;\n" + + "\n" + + "declare Bean1 extends Bean2 \n" + + " foo : int @key\n" + + "end\n" + + "" + + "declare Bean2 extends Bean3 \n" + + " foo : int @key\n" + + "end\n" + + "" + + "declare Bean3 extends Bean1 \n" + + " foo : int @key\n" + + "end\n"; + + KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder( ); + kBuilder.add( new ByteArrayResource( s1.getBytes() ), ResourceType.DRL ); + assertTrue( kBuilder.hasErrors() ); + + System.out.println( kBuilder.getErrors() ); + assertTrue( kBuilder.getErrors().toString().contains( "circular" ) ); + } }
b792e33fdb52d83b0ce13bf2eaa98c0242bce157
intellij-community
added additional shortcut--
a
https://github.com/JetBrains/intellij-community
diff --git a/EDIDE/src/ru/compscicenter/edide/StudyTaskManager.java b/EDIDE/src/ru/compscicenter/edide/StudyTaskManager.java index b8d72745c9115..4335b5b1a4f08 100644 --- a/EDIDE/src/ru/compscicenter/edide/StudyTaskManager.java +++ b/EDIDE/src/ru/compscicenter/edide/StudyTaskManager.java @@ -115,6 +115,7 @@ public void run() { addShortcut(NextWindowAction.SHORTCUT, NextWindowAction.ACTION_ID); addShortcut(PrevWindowAction.SHORTCUT, PrevWindowAction.ACTION_ID); addShortcut(ShowHintAction.SHORTCUT, ShowHintAction.ACTION_ID); + addShortcut(NextWindowAction.SHORTCUT2, NextWindowAction.ACTION_ID); } } }); diff --git a/EDIDE/src/ru/compscicenter/edide/actions/NextWindowAction.java b/EDIDE/src/ru/compscicenter/edide/actions/NextWindowAction.java index 1053f1be54ed8..7f91b90ec5cbf 100644 --- a/EDIDE/src/ru/compscicenter/edide/actions/NextWindowAction.java +++ b/EDIDE/src/ru/compscicenter/edide/actions/NextWindowAction.java @@ -19,6 +19,7 @@ public class NextWindowAction extends DumbAwareAction { public static final String ACTION_ID = "NextWindow"; public static final String SHORTCUT = "ctrl pressed PERIOD"; + public static final String SHORTCUT2 = "ctrl pressed ENTER"; public void actionPerformed(AnActionEvent e) { Project project = e.getProject();
a1a7deebf8b28e3b09260f9d1f56b4f687fde672
hadoop
YARN-3587. Fix the javadoc of- DelegationTokenSecretManager in yarn, etc. projects. Contributed by Gabor- Liptak. (cherry picked from commit 7e543c27fa2881aa65967be384a6203bd5b2304f)--
p
https://github.com/apache/hadoop
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java index 52e6a0158266a..1d7f2f5328545 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java @@ -99,6 +99,17 @@ class AbstractDelegationTokenSecretManager<TokenIdent */ protected Object noInterruptsLock = new Object(); + /** + * Create a secret manager + * @param delegationKeyUpdateInterval the number of milliseconds for rolling + * new secret keys. + * @param delegationTokenMaxLifetime the maximum lifetime of the delegation + * tokens in milliseconds + * @param delegationTokenRenewInterval how often the tokens must be renewed + * in milliseconds + * @param delegationTokenRemoverScanInterval how often the tokens are scanned + * for expired tokens in milliseconds + */ public AbstractDelegationTokenSecretManager(long delegationKeyUpdateInterval, long delegationTokenMaxLifetime, long delegationTokenRenewInterval, long delegationTokenRemoverScanInterval) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java index 8af7ebaa0bfcf..b7f89a896dae9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java @@ -79,13 +79,14 @@ public DelegationTokenSecretManager(long delegationKeyUpdateInterval, /** * Create a secret manager - * @param delegationKeyUpdateInterval the number of seconds for rolling new - * secret keys. + * @param delegationKeyUpdateInterval the number of milliseconds for rolling + * new secret keys. * @param delegationTokenMaxLifetime the maximum lifetime of the delegation - * tokens + * tokens in milliseconds * @param delegationTokenRenewInterval how often the tokens must be renewed + * in milliseconds * @param delegationTokenRemoverScanInterval how often the tokens are scanned - * for expired tokens + * for expired tokens in milliseconds * @param storeTokenTrackingId whether to store the token's tracking id */ public DelegationTokenSecretManager(long delegationKeyUpdateInterval, diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/token/delegation/DelegationTokenSecretManager.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/token/delegation/DelegationTokenSecretManager.java index b42e0c9f8c118..2a109b63b233c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/token/delegation/DelegationTokenSecretManager.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/token/delegation/DelegationTokenSecretManager.java @@ -34,13 +34,14 @@ public class DelegationTokenSecretManager /** * Create a secret manager - * @param delegationKeyUpdateInterval the number of seconds for rolling new - * secret keys. + * @param delegationKeyUpdateInterval the number of milliseconds for rolling + * new secret keys. * @param delegationTokenMaxLifetime the maximum lifetime of the delegation - * tokens + * tokens in milliseconds * @param delegationTokenRenewInterval how often the tokens must be renewed + * in milliseconds * @param delegationTokenRemoverScanInterval how often the tokens are scanned - * for expired tokens + * for expired tokens in milliseconds */ public DelegationTokenSecretManager(long delegationKeyUpdateInterval, long delegationTokenMaxLifetime, diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JHSDelegationTokenSecretManager.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JHSDelegationTokenSecretManager.java index 7fac44df8cf17..98d13a46023f2 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JHSDelegationTokenSecretManager.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JHSDelegationTokenSecretManager.java @@ -47,13 +47,14 @@ public class JHSDelegationTokenSecretManager /** * Create a secret manager - * @param delegationKeyUpdateInterval the number of seconds for rolling new - * secret keys. + * @param delegationKeyUpdateInterval the number of milliseconds for rolling + * new secret keys. * @param delegationTokenMaxLifetime the maximum lifetime of the delegation - * tokens + * tokens in milliseconds * @param delegationTokenRenewInterval how often the tokens must be renewed + * in milliseconds * @param delegationTokenRemoverScanInterval how often the tokens are scanned - * for expired tokens + * for expired tokens in milliseconds * @param store history server state store for persisting state */ public JHSDelegationTokenSecretManager(long delegationKeyUpdateInterval, diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 97de524ec42b2..e9ecc9eb74e18 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -179,6 +179,9 @@ Release 2.8.0 - UNRELEASED YARN-3395. FairScheduler: Trim whitespaces when using username for queuename. (Zhihai Xu via kasha) + YARN-3587. Fix the javadoc of DelegationTokenSecretManager in yarn, etc. + projects. (Gabor Liptak via junping_du) + OPTIMIZATIONS YARN-3339. TestDockerContainerExecutor should pull a single image and not diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineDelegationTokenSecretManagerService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineDelegationTokenSecretManagerService.java index c940eea703704..60a0348b0451e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineDelegationTokenSecretManagerService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineDelegationTokenSecretManagerService.java @@ -125,11 +125,15 @@ public static class TimelineDelegationTokenSecretManager extends /** * Create a timeline secret manager - * - * @param delegationKeyUpdateInterval the number of seconds for rolling new secret keys. - * @param delegationTokenMaxLifetime the maximum lifetime of the delegation tokens + * @param delegationKeyUpdateInterval the number of milliseconds for rolling + * new secret keys. + * @param delegationTokenMaxLifetime the maximum lifetime of the delegation + * tokens in milliseconds * @param delegationTokenRenewInterval how often the tokens must be renewed - * @param delegationTokenRemoverScanInterval how often the tokens are scanned for expired tokens + * in milliseconds + * @param delegationTokenRemoverScanInterval how often the tokens are + * scanned for expired tokens in milliseconds + * @param stateStore timeline service state store */ public TimelineDelegationTokenSecretManager( long delegationKeyUpdateInterval, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java index 83defc5424707..631ca9d2e5a75 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java @@ -56,13 +56,15 @@ public class RMDelegationTokenSecretManager extends /** * Create a secret manager - * @param delegationKeyUpdateInterval the number of seconds for rolling new - * secret keys. + * @param delegationKeyUpdateInterval the number of milliseconds for rolling + * new secret keys. * @param delegationTokenMaxLifetime the maximum lifetime of the delegation - * tokens + * tokens in milliseconds * @param delegationTokenRenewInterval how often the tokens must be renewed + * in milliseconds * @param delegationTokenRemoverScanInterval how often the tokens are scanned - * for expired tokens + * for expired tokens in milliseconds + * @param rmContext current context of the ResourceManager */ public RMDelegationTokenSecretManager(long delegationKeyUpdateInterval, long delegationTokenMaxLifetime,
48d33ec70a8ea6f872006e46d1c8e0cdd48a2c81
elasticsearch
Cluster Health API: Add `wait_for_nodes` (accepts- "N", "<N", ">N", "<=N", and ">=N"), closes -269.--
a
https://github.com/elastic/elasticsearch
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java index b137902474add..8dd124ece5bf1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java @@ -46,6 +46,8 @@ public class ClusterHealthRequest extends MasterNodeOperationRequest { private int waitForActiveShards = -1; + private String waitForNodes = ""; + ClusterHealthRequest() { } @@ -110,6 +112,18 @@ public ClusterHealthRequest waitForActiveShards(int waitForActiveShards) { return this; } + public String waitForNodes() { + return waitForNodes; + } + + /** + * Waits for N number of nodes. Use "12" for exact mapping, ">12" and "<12" for range. + */ + public ClusterHealthRequest waitForNodes(String waitForNodes) { + this.waitForNodes = waitForNodes; + return this; + } + @Override public ActionRequestValidationException validate() { return null; } @@ -131,6 +145,7 @@ public ClusterHealthRequest waitForActiveShards(int waitForActiveShards) { } waitForRelocatingShards = in.readInt(); waitForActiveShards = in.readInt(); + waitForNodes = in.readUTF(); } @Override public void writeTo(StreamOutput out) throws IOException { @@ -152,5 +167,6 @@ public ClusterHealthRequest waitForActiveShards(int waitForActiveShards) { } out.writeInt(waitForRelocatingShards); out.writeInt(waitForActiveShards); + out.writeUTF(waitForNodes); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java index 878da47de34dd..199f5c7dd1cbd 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java @@ -40,6 +40,8 @@ public class ClusterHealthResponse implements ActionResponse, Iterable<ClusterIn private String clusterName; + int numberOfNodes = 0; + int activeShards = 0; int relocatingShards = 0; @@ -127,6 +129,14 @@ public int getActivePrimaryShards() { return activePrimaryShards(); } + public int numberOfNodes() { + return this.numberOfNodes; + } + + public int getNumberOfNodes() { + return numberOfNodes(); + } + /** * <tt>true</tt> if the waitForXXX has timeout out and did not match. */ @@ -163,6 +173,7 @@ public Map<String, ClusterIndexHealth> getIndices() { activePrimaryShards = in.readVInt(); activeShards = in.readVInt(); relocatingShards = in.readVInt(); + numberOfNodes = in.readVInt(); status = ClusterHealthStatus.fromValue(in.readByte()); int size = in.readVInt(); for (int i = 0; i < size; i++) { @@ -185,6 +196,7 @@ public Map<String, ClusterIndexHealth> getIndices() { out.writeVInt(activePrimaryShards); out.writeVInt(activeShards); out.writeVInt(relocatingShards); + out.writeVInt(numberOfNodes); out.writeByte(status.value()); out.writeVInt(indices.size()); for (ClusterIndexHealth indexHealth : this) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java index fe8806ac6b364..c5cd20ea1f831 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java @@ -65,7 +65,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeOperationAc } @Override protected ClusterHealthResponse masterOperation(ClusterHealthRequest request, ClusterState state) throws ElasticSearchException { - int waitFor = 3; + int waitFor = 4; if (request.waitForStatus() == null) { waitFor--; } @@ -75,6 +75,9 @@ public class TransportClusterHealthAction extends TransportMasterNodeOperationAc if (request.waitForActiveShards() == -1) { waitFor--; } + if (request.waitForNodes().isEmpty()) { + waitFor--; + } if (waitFor == 0) { // no need to wait for anything return clusterHealth(request); @@ -92,6 +95,34 @@ public class TransportClusterHealthAction extends TransportMasterNodeOperationAc if (request.waitForActiveShards() != -1 && response.activeShards() >= request.waitForActiveShards()) { waitForCounter++; } + if (!request.waitForNodes().isEmpty()) { + if (request.waitForNodes().startsWith(">=")) { + int expected = Integer.parseInt(request.waitForNodes().substring(2)); + if (response.numberOfNodes() >= expected) { + waitForCounter++; + } + } else if (request.waitForNodes().startsWith("M=")) { + int expected = Integer.parseInt(request.waitForNodes().substring(2)); + if (response.numberOfNodes() <= expected) { + waitForCounter++; + } + } else if (request.waitForNodes().startsWith(">")) { + int expected = Integer.parseInt(request.waitForNodes().substring(1)); + if (response.numberOfNodes() > expected) { + waitForCounter++; + } + } else if (request.waitForNodes().startsWith("<")) { + int expected = Integer.parseInt(request.waitForNodes().substring(1)); + if (response.numberOfNodes() < expected) { + waitForCounter++; + } + } else { + int expected = Integer.parseInt(request.waitForNodes()); + if (response.numberOfNodes() == expected) { + waitForCounter++; + } + } + } if (waitForCounter == waitFor) { return response; } @@ -113,7 +144,7 @@ private ClusterHealthResponse clusterHealth(ClusterHealthRequest request) { ClusterState clusterState = clusterService.state(); RoutingTableValidation validation = clusterState.routingTable().validate(clusterState.metaData()); ClusterHealthResponse response = new ClusterHealthResponse(clusterName.value(), validation.failures()); - + response.numberOfNodes = clusterState.nodes().size(); request.indices(clusterState.metaData().concreteIndices(request.indices())); for (String index : request.indices()) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/cluster/health/ClusterHealthRequestBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/cluster/health/ClusterHealthRequestBuilder.java index 7961c3ba7f403..1a40edbee03a0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/cluster/health/ClusterHealthRequestBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/cluster/health/ClusterHealthRequestBuilder.java @@ -84,6 +84,14 @@ public ClusterHealthRequestBuilder setWaitForActiveShards(int waitForActiveShard return this; } + /** + * Waits for N number of nodes. Use "12" for exact mapping, ">12" and "<12" for range. + */ + public ClusterHealthRequestBuilder setWaitForNodes(String waitForNodes) { + request.waitForNodes(waitForNodes); + return this; + } + @Override protected void doExecute(ActionListener<ClusterHealthResponse> listener) { client.health(request, listener); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java index d50018e477d37..9caa0058b346b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java @@ -276,6 +276,9 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine, // we obtain a read lock here, since we don't want a flush to happen while we are refreshing // since it flushes the index as well (though, in terms of concurrency, we are allowed to do it) rwl.readLock().lock(); + if (indexWriter == null) { + throw new EngineClosedException(shardId); + } try { // this engine always acts as if waitForOperations=true if (refreshMutex.compareAndSet(false, true)) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java index 348a215578ed1..54f136a12e6d4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java @@ -36,10 +36,7 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.index.cache.IndexCache; -import org.elasticsearch.index.engine.Engine; -import org.elasticsearch.index.engine.EngineException; -import org.elasticsearch.index.engine.RefreshFailedEngineException; -import org.elasticsearch.index.engine.ScheduledRefreshableEngine; +import org.elasticsearch.index.engine.*; import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.DocumentMapperNotFoundException; import org.elasticsearch.index.mapper.MapperService; @@ -517,6 +514,8 @@ private class EngineRefresher implements Runnable { @Override public void run() { try { engine.refresh(new Engine.Refresh(false)); + } catch (EngineClosedException e) { + // we are being closed, ignore } catch (RefreshFailedEngineException e) { if (e.getCause() instanceof InterruptedException) { // ignore, we are being shutdown diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java index 037ff0c32e205..1a8e477257011 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java @@ -57,6 +57,7 @@ public class RestClusterHealthAction extends BaseRestHandler { } clusterHealthRequest.waitForRelocatingShards(request.paramAsInt("wait_for_relocating_shards", clusterHealthRequest.waitForRelocatingShards())); clusterHealthRequest.waitForActiveShards(request.paramAsInt("wait_for_active_shards", clusterHealthRequest.waitForActiveShards())); + clusterHealthRequest.waitForNodes(request.param("wait_for_nodes", clusterHealthRequest.waitForNodes())); String sLevel = request.param("level"); if (sLevel != null) { if ("cluster".equals("sLevel")) { @@ -85,6 +86,7 @@ public class RestClusterHealthAction extends BaseRestHandler { builder.field("status", response.status().name().toLowerCase()); builder.field("timed_out", response.timedOut()); + builder.field("number_of_nodes", response.numberOfNodes()); builder.field("active_primary_shards", response.activePrimaryShards()); builder.field("active_shards", response.activeShards()); builder.field("relocating_shards", response.relocatingShards()); diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/datanode/SimpleDataNodesTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/datanode/SimpleDataNodesTests.java index 967180e807fd7..908406a84a90f 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/datanode/SimpleDataNodesTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/datanode/SimpleDataNodesTests.java @@ -52,7 +52,7 @@ public class SimpleDataNodesTests extends AbstractNodesTests { } startNode("nonData2", settingsBuilder().put("node.data", false).build()); - Thread.sleep(500); + assertThat(client("nonData1").admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet().timedOut(), equalTo(false)); // still no shard should be allocated try { @@ -64,7 +64,7 @@ public class SimpleDataNodesTests extends AbstractNodesTests { // now, start a node data, and see that it gets with shards startNode("data1", settingsBuilder().put("node.data", true).build()); - Thread.sleep(500); + assertThat(client("nonData1").admin().cluster().prepareHealth().setWaitForNodes("3").execute().actionGet().timedOut(), equalTo(false)); IndexResponse indexResponse = client("nonData2").index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); assertThat(indexResponse.id(), equalTo("1")); diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java index 5cc344d2d79cb..76b80ae7e68c8 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java @@ -89,12 +89,10 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { logger.info("Starting server2"); // start another server startNode("server2", settings); - Thread.sleep(200); - ClusterService clusterService2 = ((InternalNode) node("server2")).injector().getInstance(ClusterService.class); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus()).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForNodes("2")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.status()); assertThat(clusterHealth.timedOut(), equalTo(false)); assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN)); @@ -113,12 +111,11 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { logger.info("Starting server3"); // start another server startNode("server3", settings); - Thread.sleep(200); ClusterService clusterService3 = ((InternalNode) node("server3")).injector().getInstance(ClusterService.class); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForRelocatingShards(0)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForNodes("3").waitForRelocatingShards(0)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.status()); assertThat(clusterHealth.timedOut(), equalTo(false)); assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN)); @@ -146,11 +143,9 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { logger.info("Closing server1"); // kill the first server closeNode("server1"); - // wait a bit so it will be discovered as removed - Thread.sleep(200); // verify health logger.info("Running Cluster Health"); - clusterHealth = client("server2").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForRelocatingShards(0)).actionGet(); + clusterHealth = client("server2").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForRelocatingShards(0).waitForNodes("2")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.status()); assertThat(clusterHealth.timedOut(), equalTo(false)); assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN)); @@ -219,11 +214,9 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { // start another server logger.info("Starting server2"); startNode("server2", settings); - // wait a bit - Thread.sleep(200); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForRelocatingShards(0)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForRelocatingShards(0).waitForNodes("2")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.status()); assertThat(clusterHealth.timedOut(), equalTo(false)); assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN)); @@ -247,13 +240,11 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { // start another server logger.info("Starting server3"); startNode("server3"); - // wait a bit so assignment will start - Thread.sleep(200); ClusterService clusterService3 = ((InternalNode) node("server3")).injector().getInstance(ClusterService.class); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForRelocatingShards(0)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForRelocatingShards(0).waitForNodes("3")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.status()); assertThat(clusterHealth.timedOut(), equalTo(false)); assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN)); @@ -281,11 +272,9 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { logger.info("Closing server1"); // kill the first server closeNode("server1"); - // wait a bit so it will be discovered as removed - Thread.sleep(200); logger.info("Running Cluster Health"); - clusterHealth = client("server3").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForRelocatingShards(0)).actionGet(); + clusterHealth = client("server3").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForNodes("2").waitForRelocatingShards(0)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.status()); assertThat(clusterHealth.timedOut(), equalTo(false)); assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN)); diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/FullRollingRestartTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/FullRollingRestartTests.java index 6c167df304260..f9e73d0152bf5 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/FullRollingRestartTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/FullRollingRestartTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.test.integration.recovery; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.test.integration.AbstractNodesTests; import org.testng.annotations.AfterMethod; @@ -57,14 +56,14 @@ public class FullRollingRestartTests extends AbstractNodesTests { startNode("node3"); // make sure the cluster state is green, and all has been recovered - assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet().timedOut(), equalTo(false)); // now start adding nodes startNode("node4"); startNode("node5"); // make sure the cluster state is green, and all has been recovered - assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("5").execute().actionGet().timedOut(), equalTo(false)); client("node1").admin().indices().prepareRefresh().execute().actionGet(); for (int i = 0; i < 10; i++) { @@ -74,10 +73,10 @@ public class FullRollingRestartTests extends AbstractNodesTests { // now start shutting nodes down closeNode("node1"); // make sure the cluster state is green, and all has been recovered - assertThat(client("node5").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node5").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("4").execute().actionGet().timedOut(), equalTo(false)); closeNode("node2"); // make sure the cluster state is green, and all has been recovered - assertThat(client("node5").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node5").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet().timedOut(), equalTo(false)); client("node5").admin().indices().prepareRefresh().execute().actionGet(); @@ -87,11 +86,11 @@ public class FullRollingRestartTests extends AbstractNodesTests { closeNode("node3"); // make sure the cluster state is green, and all has been recovered - assertThat(client("node5").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node5").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("2").execute().actionGet().timedOut(), equalTo(false)); closeNode("node4"); // make sure the cluster state is green, and all has been recovered - assertThat(client("node5").admin().cluster().prepareHealth().setTimeout("1m").setWaitForYellowStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.YELLOW)); + assertThat(client("node5").admin().cluster().prepareHealth().setTimeout("1m").setWaitForYellowStatus().setWaitForNodes("1").execute().actionGet().timedOut(), equalTo(false)); client("node5").admin().indices().prepareRefresh().execute().actionGet(); for (int i = 0; i < 10; i++) { diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/RecoveryWhileUnderLoadTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/RecoveryWhileUnderLoadTests.java index d3b109fcf11a9..d4466da4f77da 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/RecoveryWhileUnderLoadTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/RecoveryWhileUnderLoadTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.test.integration.recovery; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; @@ -104,7 +103,7 @@ public class RecoveryWhileUnderLoadTests extends AbstractNodesTests { logger.info("--> waiting for GREEN health status ..."); // make sure the cluster state is green, and all has been recovered - assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("2").execute().actionGet().timedOut(), equalTo(false)); logger.info("--> waiting for 100000 docs to be indexed ..."); while (client("node1").prepareCount().setQuery(matchAllQuery()).execute().actionGet().count() < 100000) { @@ -185,7 +184,7 @@ public class RecoveryWhileUnderLoadTests extends AbstractNodesTests { startNode("node4"); logger.info("--> waiting for GREEN health status ..."); - assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("4").execute().actionGet().timedOut(), equalTo(false)); logger.info("--> waiting for 150000 docs to be indexed ..."); @@ -271,7 +270,7 @@ public class RecoveryWhileUnderLoadTests extends AbstractNodesTests { startNode("node4"); logger.info("--> waiting for GREEN health status ..."); - assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node1").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("4").execute().actionGet().timedOut(), equalTo(false)); logger.info("--> waiting for 100000 docs to be indexed ..."); @@ -285,24 +284,24 @@ public class RecoveryWhileUnderLoadTests extends AbstractNodesTests { logger.info("--> shutting down [node1] ..."); closeNode("node1"); logger.info("--> waiting for GREEN health status ..."); - assertThat(client("node2").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node2").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet().timedOut(), equalTo(false)); logger.info("--> shutting down [node3] ..."); closeNode("node3"); logger.info("--> waiting for GREEN health status ..."); - assertThat(client("node2").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.GREEN)); + assertThat(client("node2").admin().cluster().prepareHealth().setTimeout("1m").setWaitForGreenStatus().setWaitForNodes("2").execute().actionGet().timedOut(), equalTo(false)); logger.info("--> shutting down [node4] ..."); closeNode("node4"); logger.info("--> waiting for YELLOW health status ..."); - assertThat(client("node2").admin().cluster().prepareHealth().setTimeout("1m").setWaitForYellowStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.YELLOW)); + assertThat(client("node2").admin().cluster().prepareHealth().setTimeout("1m").setWaitForYellowStatus().setWaitForNodes("1").execute().actionGet().timedOut(), equalTo(false)); logger.info("--> marking and waiting for indexing threads to stop ..."); stop.set(true); stopLatch.await(); logger.info("--> indexing threads stopped"); - assertThat(client("node2").admin().cluster().prepareHealth().setTimeout("1m").setWaitForYellowStatus().execute().actionGet().status(), equalTo(ClusterHealthStatus.YELLOW)); + assertThat(client("node2").admin().cluster().prepareHealth().setTimeout("1m").setWaitForYellowStatus().setWaitForNodes("1").execute().actionGet().timedOut(), equalTo(false)); logger.info("--> refreshing the index"); client("node2").admin().indices().prepareRefresh().execute().actionGet(); diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/SimpleRecoveryTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/SimpleRecoveryTests.java index a60be29d7bcdc..948f9f0a6c064 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/SimpleRecoveryTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/recovery/SimpleRecoveryTests.java @@ -86,9 +86,8 @@ public class SimpleRecoveryTests extends AbstractNodesTests { // now start another one so we move some primaries startNode("server3"); - Thread.sleep(1000); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus()).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealth().waitForGreenStatus().waitForNodes("3")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.status()); assertThat(clusterHealth.timedOut(), equalTo(false)); assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN)); diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportSearchFailuresTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportSearchFailuresTests.java index 6487c12eaed41..74837b72d5fb9 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportSearchFailuresTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportSearchFailuresTests.java @@ -75,7 +75,7 @@ public class TransportSearchFailuresTests extends AbstractNodesTests { } startNode("server2"); - Thread.sleep(500); + assertThat(client("server1").admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet().timedOut(), equalTo(false)); logger.info("Running Cluster Health"); ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealth("test")