This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit b575f53dd4e1af9a0bb82f10b83584cdd04b9b05
Author: Josh Tynjala <[email protected]>
AuthorDate: Tue May 28 13:46:53 2024 -0700

    compiler: better problem message when MXML implements attribute is empty
    
    Said interface not found, but now says that empty implements is not allowed 
to be empty
---
 RELEASE_NOTES.md                                         |  1 +
 .../compiler/internal/parsing/mxml/MXMLScopeBuilder.java | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index a0245d597..a0bf021e4 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -37,6 +37,7 @@ Apache Royale Compiler 0.9.11
 - compiler: Fix null pointer exception when omitting quoted `<fx:Style>` value 
for `source` attribute.
 - compiler: Fix null pointer exception when omitting quoted `<fx:Binding>` 
value for `source`, `destination`, and `twoWay` attributes.
 - compiler: Fix missing problem for invalid `twoWay` value for `<fx:Binding>` 
tag.
+- compiler: Changed to better problem message when MXML `implements` attribute 
is empty.
 - debugger: Fix exception when evaluating certain expressions at run-time.
 - formatter: Added `insert-new-line-else` configuration option.
 - formatter: Filtered out unnecessary compiler warnings.
diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
index edd5653d4..e04e258f0 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
@@ -67,6 +67,7 @@ import org.apache.royale.compiler.mxml.IMXMLTextData;
 import org.apache.royale.compiler.mxml.IMXMLTextData.TextType;
 import org.apache.royale.compiler.mxml.IMXMLUnitData;
 import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.compiler.problems.MXMLEmptyAttributeProblem;
 import 
org.apache.royale.compiler.problems.MXMLLibraryTagNotTheFirstChildProblem;
 
 import com.google.common.collect.ImmutableSet;
@@ -183,11 +184,18 @@ public class MXMLScopeBuilder
         IReference[] implementedInterfaces = null;
         if (implementsAttrValue != null) //TODO this should use a parser 
method that collects qnames or identifiers
         {
-            String interfaces[] = 
rootTag.getMXMLDialect().trim(implementsAttrValue).split(IMPLEMENTS_SPLITTER);
-            implementedInterfaces = new IReference[interfaces.length];
-            for( int i = 0; i < interfaces.length; ++i )
+            if (implementsAttrValue.trim().length() == 0)
             {
-                implementedInterfaces[i] = 
ReferenceFactory.packageQualifiedReference(project.getWorkspace(), 
interfaces[i].trim());
+                problems.add(new 
MXMLEmptyAttributeProblem(rootTag.getTagAttributeData("implements")));
+            }
+            else
+            {
+                String interfaces[] = 
rootTag.getMXMLDialect().trim(implementsAttrValue).split(IMPLEMENTS_SPLITTER);
+                implementedInterfaces = new IReference[interfaces.length];
+                for( int i = 0; i < interfaces.length; ++i )
+                {
+                    implementedInterfaces[i] = 
ReferenceFactory.packageQualifiedReference(project.getWorkspace(), 
interfaces[i].trim());
+                }
             }
         }
 

Reply via email to