Skip to content

Commit

Permalink
testing optmizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodo1981 committed Jan 4, 2024
1 parent d3f4599 commit 12a753f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,6 @@ open class DefaultAnnotationDetector(protected val elementUtils: Elements, prote
namingMap.remove(elementNameMatcher.xmlElementName)
}
namingMap[xmlElementName] = PolymorphicTypeElementNameMatcher(xmlElementName, typeElement.asType())

if (element.getSurroundingClassQualifiedName().endsWith("CompanyConstructor")) {
messager.printMessage(
Diagnostic.Kind.WARNING, "Test2 -> ${namingMap.entries.joinToString()} "
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,17 @@ interface XmlElement {
} else {
// Conflict
val variableField = toInsert.element
throw ProcessingException(variableField,
"Conflict: $toInsert is in conflict with $existingElement. Maybe both have the same xml name '${toInsert.name}' (you can change that via annotations) or @${Path::class.simpleName} is causing this conflict.")
if (toInsert is PolymorphicSubstitutionField || toInsert is PolymorphicSubstitutionListField) {
throw ProcessingException(
variableField,
"Conflict: $toInsert is in conflict with $existingElement. Maybe both have the same xml name or type or @${Path::class.simpleName} is causing this conflict."
)
} else {
throw ProcessingException(
variableField,
"Conflict: $toInsert is in conflict with $existingElement. Maybe both have the same xml name '${toInsert.name}' (you can change that via annotations) or @${Path::class.simpleName} is causing this conflict."
)
}
}

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ class AnnotationScannerTest {
" @${ElementNameMatcher::class.qualifiedName}(name=\"b\", type=B.class) ",
" })",
" Root element;",
"",
" @${Element::class.qualifiedName}(name=\"a\")",
" Root a;",
" @${Xml::class.qualifiedName}",
Expand All @@ -608,7 +607,7 @@ class AnnotationScannerTest {
.that(componentFile).processedWith(XmlProcessor())
.failsToCompile()
.withErrorContaining(
"Conflict: field 'a' in class test.PolymorphicElement is in conflict with field 'element' in class test.PolymorphicElement. Maybe both have the same xml name 'a' (you can change that via annotations) or @${Path::class.simpleName} is causing this conflict.")
"Conflict: field 'a' in class test.PolymorphicElement is in conflict with field 'element' in class test.PolymorphicElement. Maybe both have the same xml name or type or @${Path::class.simpleName} is causing this conflict.")
}

@Test
Expand Down Expand Up @@ -667,7 +666,7 @@ class AnnotationScannerTest {
.that(componentFile).processedWith(XmlProcessor())
.failsToCompile()
.withErrorContaining(
"Conflict: field 'element' in class test.PolymorphicElement is in conflict with test.PolymorphicElement. Maybe both have the same xml name 'b' (you can change that via annotations) or @${Path::class.simpleName} is causing this conflict.")
"Conflict: field 'element' in class test.PolymorphicElement is in conflict with test.PolymorphicElement. Maybe both have the same xml name or type or @${Path::class.simpleName} is causing this conflict.")
}

/// LIST TESTS
Expand Down Expand Up @@ -727,7 +726,7 @@ class AnnotationScannerTest {
val componentFile = JavaFileObjects.forSourceLines("test.PolymorphicElement",
"package test;",
"@${Xml::class.qualifiedName}",
"class PolymorphicElement {",
"class PolymorphicElement{",
" @${Element::class.qualifiedName} ( typesByElement = {",
" @${ElementNameMatcher::class.qualifiedName}(name=\"a\", type=A.class),",
" @${ElementNameMatcher::class.qualifiedName}(name=\"b\", type=B.class)",
Expand Down Expand Up @@ -804,7 +803,7 @@ class AnnotationScannerTest {
.processedWith(XmlProcessor())
.failsToCompile()
.withErrorContaining(
"Conflict: field 'a' in class test.PolymorphicElement is in conflict with field 'element' in class test.PolymorphicElement. Maybe both have the same xml name 'a' (you can change that via annotations) or @${Path::class.simpleName} is causing this conflict.")
"Conflict: field 'a' in class test.PolymorphicElement is in conflict with field 'element' in class test.PolymorphicElement. Maybe both have the same xml name or type or @${Path::class.simpleName} is causing this conflict.")
}

@Test
Expand Down Expand Up @@ -832,7 +831,7 @@ class AnnotationScannerTest {
.that(componentFile).processedWith(XmlProcessor())
.failsToCompile()
.withErrorContaining(
"Conflict: field 'a' in class test.PolymorphicElement is in conflict with field 'element' in class test.PolymorphicElement. Maybe both have the same xml name 'a' (you can change that via annotations) or @${Path::class.java.simpleName} is causing this conflict.")
"Conflict: field 'a' in class test.PolymorphicElement is in conflict with field 'element' in class test.PolymorphicElement. Maybe both have the same xml name or type or @${Path::class.simpleName} is causing this conflict.")
}

@Test
Expand Down Expand Up @@ -942,7 +941,7 @@ class AnnotationScannerTest {
.that(componentFile).processedWith(XmlProcessor())
.failsToCompile()
.withErrorContaining(
"Conflict: field 'element' in class test.PolymorphicElement is in conflict with test.PolymorphicElement. Maybe both have the same xml name 'a' (you can change that via annotations) or @${Path::class.simpleName} is causing this conflict.")
"Conflict: field 'element' in class test.PolymorphicElement is in conflict with test.PolymorphicElement. Maybe both have the same xml name or type or @${Path::class.simpleName} is causing this conflict.")
}

@Test
Expand All @@ -969,7 +968,7 @@ class AnnotationScannerTest {
.that(componentFile).processedWith(XmlProcessor())
.failsToCompile()
.withErrorContaining(
"Conflict: field 'element' in class test.PolymorphicElement is in conflict with test.PolymorphicElement. Maybe both have the same xml name 'a' (you can change that via annotations) or @${Path::class.simpleName} is causing this conflict.")
"Conflict: field 'element' in class test.PolymorphicElement is in conflict with test.PolymorphicElement. Maybe both have the same xml name or type or @${Path::class.simpleName} is causing this conflict.")
}

@Test
Expand Down

0 comments on commit 12a753f

Please sign in to comment.