Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354887

Summary: Java Generation is invoking constructor that doesn't exist on delegate assignment statement
Product: z_Archived Reporter: Kathy Carroll <carrollk>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P3 CC: mheitz
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Archived file of Project none

Description Kathy Carroll CLA 2011-08-16 15:55:32 EDT
These two problems look similar.  

1.  Delegate variable declaration and initialization procudes invalid Java.

======= EGL code ===
library User  {}
	function invokeTheTest()
		exeLibTestMtd executeLibTestMethod = executeLibTest;
	end
	function executeLibTest(testName String) returns (MultiStatus)
		multi MultiStatus;
		return (multi);
	end	
end
Record MultiStatus
	testCnt int;
	firstFailedTestName String;
end
delegate executeLibTestMethod(testName String) returns (MultiStatus)
end
==============  Java code ============
	public void invokeTheTest() {
		org.eclipse.edt.javart.Delegate exeLibTestMtd = new org.eclipse.edt.javart.Delegate();
		exeLibTestMtd = new org.eclipse.edt.javart.Delegate("executeLibTest", this, String.class);
	}

======== Compile Error =================
The constructor Delegate() is undefined

2.  External Type without an empty constructor

=========  EGL Code ======

handler CreateResultFile 
	function createFile(fileDirectory String in, fullFileName String in, fileContent String in)
		myfile File  = new File(fileDirectory);
		createdDirs boolean = myfile.mkdirs();
		if(createdDirs)
			syslib.writeStdOut("directories created");			
		end					
	end	
end

ExternalType File type JavaObject {packageName = "java.io"}
	 constructor (pathname String In);
	 function getAbsolutePath() returns (String);
	 function createNewFile() returns (boolean);
	 function mkdirs() returns (boolean);
	 function exists() returns (boolean);
end

=========  Java code =====
	public void createFile(String fileDirectory, String fullFileName, String fileContent) {
		File myfile = new File();
		myfile = new File(fileDirectory);
		boolean createdDirs = false;
		createdDirs = myfile.mkdirs();
		if (createdDirs) {
			String eze$Temp2 = Constants.EMPTY_STRING;
			eze$Temp2 = "directories created";
			SysLib.writeStdout(eze$Temp2);
		}
	}

============  Compile Error ===========
The constructor File() is undefined
Comment 1 Kathy Carroll CLA 2011-08-17 08:21:52 EDT
Problem two has been resolved.  Still getting the issue with the Delegate constructor
Comment 2 Matt Heitz CLA 2011-08-17 23:33:36 EDT
I changed FunctionTemplate to put in the proper type (AnyBoxedObject) for Out and Inout parameters when we make a Delegate object.
Comment 3 Kathy Carroll CLA 2011-08-18 12:01:59 EDT
verified
Comment 4 Kathy Carroll CLA 2011-09-08 10:33:12 EDT
Created attachment 202998 [details]
Archived file of Project
Comment 5 Lisa Lasher CLA 2011-10-11 16:09:21 EDT
Closing this defect.