mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
closes #1499
This commit is contained in:
parent
4a89a89657
commit
b751b9e2e0
6 changed files with 33 additions and 16 deletions
|
@ -41,6 +41,8 @@ import com.google.common.collect.Lists;
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessageAcceptingTestCase implements CancelIndicator {
|
public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessageAcceptingTestCase implements CancelIndicator {
|
||||||
|
|
||||||
|
private static final int MANY = 10_000;
|
||||||
|
|
||||||
private NamesAreUniqueValidationHelper helper;
|
private NamesAreUniqueValidationHelper helper;
|
||||||
private int callCount;
|
private int callCount;
|
||||||
private int maxCallCount;
|
private int maxCallCount;
|
||||||
|
@ -363,7 +365,7 @@ public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessag
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Test public void testManyUnique() {
|
@Test public void testManyUnique() {
|
||||||
List<ENamedElement> elements = new ArrayList<>();
|
List<ENamedElement> elements = new ArrayList<>();
|
||||||
for(int i = 0; i < 1_000_000; i++) {
|
for(int i = 0; i < MANY; i++) {
|
||||||
EClass c = createEClass();
|
EClass c = createEClass();
|
||||||
c.setName("i" + i);
|
c.setName("i" + i);
|
||||||
elements.add(c);
|
elements.add(c);
|
||||||
|
@ -376,7 +378,7 @@ public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessag
|
||||||
|
|
||||||
@Test public void testManyUnique_context() {
|
@Test public void testManyUnique_context() {
|
||||||
List<ENamedElement> elements = new ArrayList<>();
|
List<ENamedElement> elements = new ArrayList<>();
|
||||||
for(int i = 0; i < 1_000_000; i++) {
|
for(int i = 0; i < MANY; i++) {
|
||||||
EClass c = createEClass();
|
EClass c = createEClass();
|
||||||
c.setName("i" + i);
|
c.setName("i" + i);
|
||||||
elements.add(c);
|
elements.add(c);
|
||||||
|
@ -389,9 +391,9 @@ public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessag
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Test public void testManyOneDup() {
|
@Test public void testManyOneDup() {
|
||||||
List<ENamedElement> elements = new ArrayList<>();
|
List<ENamedElement> elements = new ArrayList<>();
|
||||||
for(int i = 0; i < 100_000; i++) {
|
for(int i = 0; i < MANY; i++) {
|
||||||
EClass c = createEClass();
|
EClass c = createEClass();
|
||||||
if (i == 99_999) {
|
if (i == MANY - 1) {
|
||||||
c.setName("i1234");
|
c.setName("i1234");
|
||||||
} else {
|
} else {
|
||||||
c.setName("i" + i);
|
c.setName("i" + i);
|
||||||
|
@ -400,7 +402,7 @@ public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessag
|
||||||
}
|
}
|
||||||
maxCallCount = 0;
|
maxCallCount = 0;
|
||||||
expected.add(elements.get(1_234));
|
expected.add(elements.get(1_234));
|
||||||
expected.add(elements.get(99_999));
|
expected.add(elements.get(MANY - 1));
|
||||||
helper.checkUniqueNames(
|
helper.checkUniqueNames(
|
||||||
Scopes.scopedElementsFor(elements),
|
Scopes.scopedElementsFor(elements),
|
||||||
this, this);
|
this, this);
|
||||||
|
@ -408,9 +410,9 @@ public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessag
|
||||||
|
|
||||||
@Test public void testManyOneDup_context() {
|
@Test public void testManyOneDup_context() {
|
||||||
List<ENamedElement> elements = new ArrayList<>();
|
List<ENamedElement> elements = new ArrayList<>();
|
||||||
for(int i = 0; i < 100_000; i++) {
|
for(int i = 0; i < MANY; i++) {
|
||||||
EClass c = createEClass();
|
EClass c = createEClass();
|
||||||
if (i == 99_999) {
|
if (i == MANY - 1) {
|
||||||
c.setName("i1234");
|
c.setName("i1234");
|
||||||
} else {
|
} else {
|
||||||
c.setName("i" + i);
|
c.setName("i" + i);
|
||||||
|
@ -419,7 +421,7 @@ public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessag
|
||||||
}
|
}
|
||||||
maxCallCount = 0;
|
maxCallCount = 0;
|
||||||
expected.add(elements.get(1_234));
|
expected.add(elements.get(1_234));
|
||||||
expected.add(elements.get(99_999));
|
expected.add(elements.get(MANY - 1));
|
||||||
helper.checkUniqueNames(
|
helper.checkUniqueNames(
|
||||||
new LocalUniqueNameContext(elements, this), this);
|
new LocalUniqueNameContext(elements, this), this);
|
||||||
}
|
}
|
||||||
|
@ -427,7 +429,7 @@ public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessag
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Test public void testManyManyDup() {
|
@Test public void testManyManyDup() {
|
||||||
List<ENamedElement> elements = new ArrayList<>();
|
List<ENamedElement> elements = new ArrayList<>();
|
||||||
for(int i = 0, j = 0; i < 100_000; i++) {
|
for(int i = 0, j = 0; i < MANY; i++) {
|
||||||
if (i % 100 == 0) {
|
if (i % 100 == 0) {
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
@ -444,7 +446,7 @@ public class NamesAreUniqueValidationHelperTest extends AbstractValidationMessag
|
||||||
|
|
||||||
@Test public void testManyManyDup_context() {
|
@Test public void testManyManyDup_context() {
|
||||||
List<ENamedElement> elements = new ArrayList<>();
|
List<ENamedElement> elements = new ArrayList<>();
|
||||||
for(int i = 0, j = 0; i < 100_000; i++) {
|
for(int i = 0, j = 0; i < MANY; i++) {
|
||||||
if (i % 100 == 0) {
|
if (i % 100 == 0) {
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
|
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
|
||||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class DefaultDeclarativeQualifiedNameProvider extends IQualifiedNameProvi
|
||||||
* Tries to obtain the FQN of the given object from the {@link #cache}. If it is absent,
|
* Tries to obtain the FQN of the given object from the {@link #cache}. If it is absent,
|
||||||
* it computes a new name.
|
* it computes a new name.
|
||||||
*
|
*
|
||||||
* @see #computeFullyQualifiedName(EObject).
|
* @see #computeFullyQualifiedName(EObject)
|
||||||
* @since 2.15
|
* @since 2.15
|
||||||
*/
|
*/
|
||||||
protected QualifiedName getOrComputeFullyQualifiedName(final EObject obj) {
|
protected QualifiedName getOrComputeFullyQualifiedName(final EObject obj) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.xtext.serializer.ISerializationContext;
|
||||||
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider;
|
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider;
|
||||||
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.IConstraint;
|
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.IConstraint;
|
||||||
import org.eclipse.xtext.serializer.analysis.ISemanticSequencerNfaProvider.ISemState;
|
import org.eclipse.xtext.serializer.analysis.ISemanticSequencerNfaProvider.ISemState;
|
||||||
|
import org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer;
|
||||||
import org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.SerializableObject;
|
import org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.SerializableObject;
|
||||||
import org.eclipse.xtext.util.formallang.Nfa;
|
import org.eclipse.xtext.util.formallang.Nfa;
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ public interface INamesAreUniqueValidationHelper {
|
||||||
ISelectable getValidationScope(IEObjectDescription description, EClass clusterType);
|
ISelectable getValidationScope(IEObjectDescription description, EClass clusterType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the objects that should be checked for uniqueness in the context of their {@link #getValidationScope(EClass)}.
|
* Returns the objects that should be checked for uniqueness in the context of their {@link #getValidationScope(IEObjectDescription, EClass)}.
|
||||||
*/
|
*/
|
||||||
Iterable<IEObjectDescription> getObjectsToValidate();
|
Iterable<IEObjectDescription> getObjectsToValidate();
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public interface INamesAreUniqueValidationHelper {
|
||||||
* the same cluster will not get any errors.
|
* the same cluster will not get any errors.
|
||||||
* @see INamesAreUniqueValidationHelper#checkUniqueNames(Iterable, CancelIndicator, ValidationMessageAcceptor)
|
* @see INamesAreUniqueValidationHelper#checkUniqueNames(Iterable, CancelIndicator, ValidationMessageAcceptor)
|
||||||
*
|
*
|
||||||
* @deprecated Implementations should adhere to the context provided via {@link #checkUniqueNames(Iterable, Context, ValidationMessageAcceptor)}
|
* @deprecated Implementations should adhere to the context provided via {@link #checkUniqueNames(Context, ValidationMessageAcceptor)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
default void checkUniqueNames(Iterable<IEObjectDescription> descriptions, ValidationMessageAcceptor acceptor) {
|
default void checkUniqueNames(Iterable<IEObjectDescription> descriptions, ValidationMessageAcceptor acceptor) {
|
||||||
|
@ -147,7 +147,7 @@ public interface INamesAreUniqueValidationHelper {
|
||||||
* the same cluster will not get any errors. The cancel indicator may be used to abort
|
* the same cluster will not get any errors. The cancel indicator may be used to abort
|
||||||
* the validation.
|
* the validation.
|
||||||
*
|
*
|
||||||
* @deprecated Implementations should adhere to the context provided via {@link #checkUniqueNames(Iterable, Context, ValidationMessageAcceptor)}
|
* @deprecated Implementations should adhere to the context provided via {@link #checkUniqueNames(Context, ValidationMessageAcceptor)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void checkUniqueNames(Iterable<IEObjectDescription> descriptions, CancelIndicator cancelIndicator, ValidationMessageAcceptor acceptor);
|
void checkUniqueNames(Iterable<IEObjectDescription> descriptions, CancelIndicator cancelIndicator, ValidationMessageAcceptor acceptor);
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class NamesAreUniqueValidationHelper implements INamesAreUniqueValidation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Since Xtext 2.22 implementations should adhere to the context provided via
|
* @deprecated Since Xtext 2.22 implementations should adhere to the context provided via
|
||||||
* {@link #checkUniqueNames(Iterable, Context, ValidationMessageAcceptor)}.
|
* {@link #checkUniqueNames(org.eclipse.xtext.validation.INamesAreUniqueValidationHelper.Context, ValidationMessageAcceptor)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,7 +73,7 @@ public class NamesAreUniqueValidationHelper implements INamesAreUniqueValidation
|
||||||
* about its canceled state.
|
* about its canceled state.
|
||||||
*
|
*
|
||||||
* @deprecated Since Xtext 2.22 implementations should adhere to the context provided via
|
* @deprecated Since Xtext 2.22 implementations should adhere to the context provided via
|
||||||
* {@link #checkUniqueNames(Iterable, Context, ValidationMessageAcceptor)}.
|
* {@link #checkUniqueNames(org.eclipse.xtext.validation.INamesAreUniqueValidationHelper.Context, ValidationMessageAcceptor)}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue