summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-07-28 15:49:36 (EDT)
committerpelder2006-07-28 15:49:36 (EDT)
commitc14e8a1a44f8e083528a6acbd54993a4ec05cf8b (patch)
tree6fbd28d9d31ec08d38846520319c15446bd356bd
parent3574cd8017fe41298997e26c0fd8e35b9583a65e (diff)
downloadorg.eclipse.jet-c14e8a1a44f8e083528a6acbd54993a4ec05cf8b.zip
org.eclipse.jet-c14e8a1a44f8e083528a6acbd54993a4ec05cf8b.tar.gz
org.eclipse.jet-c14e8a1a44f8e083528a6acbd54993a4ec05cf8b.tar.bz2
[147714] Allow namespace-less tags that expect no content to appear as <tag ...> as well the standard <tag .../>
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/ASTCompilerParseListener.java7
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/Problem.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java2
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties1
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java2
5 files changed, 15 insertions, 3 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/ASTCompilerParseListener.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/ASTCompilerParseListener.java
index b50d4cf..f8e6911 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/ASTCompilerParseListener.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/ASTCompilerParseListener.java
@@ -576,9 +576,10 @@ class ASTCompilerParseListener implements JETParseEventListener2
{
// bug 147714: for DPTK compatibility, allow empty tags to appear as <tagname ...> instead of <tagname .../>
// We only allow this for tags that have no namespace (as DPTK did not support namespaces).
- recordProblem(ParseProblemSeverity.WARNING, Problem.TagCannotHaveContent,
- JET2Messages.JET2Compiler_TagCannotHaveContent,
- new Object [0], start.getCursor(), stop.getCursor(), start.getLine(), start.getCol());
+ recordProblem(ParseProblemSeverity.WARNING, Problem.TagInterpretedAsEmptyTag,
+ JET2Messages.JET2Compiler_TagShouldBeEmptyFormat,
+ new Object [] {"<" + tagName + "/>"}, //$NON-NLS-1$ //$NON-NLS-2$
+ start.getCursor(), stop.getCursor(), start.getLine(), start.getCol());
handleXMLEmptyTag(tagName, start, stop, attributeMap);
}
else
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/Problem.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/Problem.java
index d87c8d5..4a87d6d 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/Problem.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/compiler/Problem.java
@@ -116,6 +116,12 @@ public class Problem
*/
public static final int UnknownXMLTag = 16;
+ /**
+ * A tag this is declared as an 'emptyTag' occured as &lt;tag ...&gt;, and has been
+ * interpreted as the equivalent empty tag &lt;tag .../&gt;.
+ */
+ public static final int TagInterpretedAsEmptyTag = 17;
+
private final String originatingFileName;
private final int id;
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java
index 9e77691..0d578df 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java
@@ -65,6 +65,8 @@ public class JET2Messages extends NLS
public static String JET2BundleBuildTool_CreatingJar;
+ public static String JET2Compiler_TagShouldBeEmptyFormat;
+
public static String JET2Context_InvalidVariableName;
public static String JETStreamMonitor_Debug;
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties
index 32f622d..7b1eeb5 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties
@@ -55,6 +55,7 @@ JET2Compiler_ErrorRemovingMarkers=Unexpected error removing resource markers
JET2Compiler_ErrorCreatingMarkers=Unexpected exception creating problem markers
JET2Compiler_SameJavaClassAsOther=This template creates the same Java class {0} as {1}
JET2Compiler_TagCannotHaveContent=Tag can only occur as an empty tag.
+JET2Compiler_TagShouldBeEmptyFormat=Tag should be have format {0}
JET2Compiler_DeprecatedAttribute=Use of deprecated attribute: {0}
JET2Compiler_MissingDirectiveAttribute=The {0} directive requires an {1} attribute.
JET2Compiler_MissingRequiredAttribute=Missing required attribute: {0}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java
index 4034d98..1089556 100644
--- a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestJET2Parser.java
@@ -290,9 +290,11 @@ public class TestJET2Parser extends TestCase {
// This assertions correspond to comments in bug147714.jet
assertEquals("Problem 1 line number", 8, problem[0].getLineNumber());
assertEquals("Problem 1 severity", ParseProblemSeverity.ERROR, problem[0].getSeverity());
+ assertEquals("Problem 1 id", Problem.MissingXmlEndTag, problem[0].getId());
assertEquals("Problem 2 line number", 10, problem[1].getLineNumber());
assertEquals("Problem 2 severity", ParseProblemSeverity.WARNING, problem[1].getSeverity());
+ assertEquals("Problem 2 id", Problem.TagInterpretedAsEmptyTag, problem[1].getId());
}