Bug 132174

Summary: java import - "final" and "comments" in method declaration not parsed correctly
Product: [Applications] umbrello Reporter: JP Fournier <jfournier121>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Slackware   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch to ignore final an comments in method decls

Description JP Fournier 2006-08-10 02:07:15 UTC
Version:           1.5.4+ : svn 571261 (using KDE KDE 3.5.0)
Installed from:    Slackware Packages
Compiler:          gcc 
OS:                Linux

While importing Azareus java code I ran into problems importing code similar to the class below.  The problems were the "final" modifier to the argument, and the comment occuring on the same line as an argument decl.


import pack1.*;

public class Format{
	public void update(final int arg, final int[] arg2){
        }

	public void update( 
		int value1,   // a comment
		int value2   // a second comment
	) {

	}
}
Comment 1 JP Fournier 2006-08-10 02:11:24 UTC
Created attachment 17323 [details]
patch to ignore final an comments in method decls
Comment 2 Oliver Kellogg 2006-08-10 06:41:02 UTC
SVN commit 571621 by okellogg:

Attachment 17323 [details] from JP Fournier adds handling of keyword
"final" and trailing comments at argument declarations.
BUG:132174


 M  +2 -0      ChangeLog  
 M  +4 -0      umbrello/codeimport/javaimport.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #571620:571621
@@ -8,6 +8,8 @@
 * Java import: unable to import AzareusCore (131961)
 * Java import: error on multidimensional arrays (132017)
 * Java import - array types not resolved correctly (132035)
+* Java import - "final" and comments in method declaration
+  not parsed correctly (132174)
 
 Version 1.5.4
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #571620:571621
@@ -502,6 +502,10 @@
         m_srcIndex++;
         while (m_srcIndex < srcLength && m_source[m_srcIndex] != ")") {
             QString typeName = m_source[m_srcIndex];
+            if ( typeName == "final" || typeName.startsWith( "//") ) {
+                // ignore the "final" keyword and any comments in method args
+                typeName = advance();
+            } 
             typeName = joinTypename(typeName);
             QString parName = advance();
             // the Class might not be resolved yet so resolve it if necessary