| Summary: | -genEnhanced does not add toString for union | ||
|---|---|---|---|
| Product: | JacORB | Reporter: | David Newcomb <david.newcomb> |
| Component: | IDL compiler | Assignee: | Mailinglist to track bugs <jacorb-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | jacorb |
| Priority: | P5 | ||
| Version: | 2.3.1 | ||
| Hardware: | PC | ||
| OS: | All | ||
Should the toString methods contain new line characters? (See #873) Enhancement request so lowering priority. However, any patches (ideally with a testcase) would be welcome. I believe this is fixed ( test with SHA 0aca0c476907dcb303d3e45ef8aa725782f798fc ) added. |
Documentation says it only applies to StructType, but this is strictly not the case. It should also be expanded to include unions. For IDL code: struct RushIdent { long long first ; long long second ; } ; struct PositionData { FormatCode format ; long poolID ; long long poolFrame ; short skew ; RushIdent rushID ; long rushFrame ; } ; union ServerFragmentData switch (FragmentType) { case videoFragment: PositionData videoFragmentData ; // lots more } ; struct ServerFragment { long trackNum ; long start ; long finish ; ServerFragmentData fragmentData ; } ; Test code: RushIdent rid = new RushIdent () ; rid.first = 1 ; rid.second = 2 ; PositionData pd = new PositionData () ; pd.format = 1 ; pd.poolFrame = 2 ; pd.poolID = 3 ; pd.rushFrame = 4 ; pd.skew = 5 ; pd.rushID = rid ; ServerFragmentData sfd = new ServerFragmentData () ; sfd.videoFragmentData (pd) ; ServerFragment sf = new ServerFragment () ; sf.start = 10 ; sf.finish = 20 ; sf.trackNum = 1 ; sf.fragmentData = sfd ; System.out.println ("---------") ; System.out.println ("sf=" + sf) ; System.out.println ("---------") ; System.out.println ("sfd=" + sfd) ; System.out.println ("---------") ; System.out.println ("pd=" + pd) ; System.out.println ("---------") ; System.out.println ("rid=" + rid) ; System.out.println ("---------") ; output: --------- sf=com.company.project.ServerFragment@1d5e499 --------- sfd=com.company.project.ServerFragmentData@19302fb --------- pd=com.company.project.PositionData@a8cd58 --------- rid=com.company.project.RushIdent@4173b9 --------- output with -genEnhanced --------- sf=struct com.company.project.ServerFragment { int trackNum=1, int start=10, int finish=20, com.company.project.ServerFragmentData fragmentData=com.company.project.ServerFragmentData@16c03ee } --------- sfd=com.company.project.ServerFragmentData@16c03ee --------- pd=struct com.company.project.PositionData { short format=1, int poolID=3, long poolFrame=2, short skew=5, com.company.project.RushIdent rushID=struct com.company.project.RushIdent { long first=1, long second=2 }, int rushFrame=4 } --------- rid=struct com.company.project.RushIdent { long first=1, long second=2 } --------- I hope you can see that the output from ServerFragment and ServerFragmentData is useless. Their toString methods should cascade down calling toString on all contained IDL generated objects. As a developer I still have to inspect all the sub parts myself and write my own toString methods which contain IDL types. The "union".toString() should look at the discriminator and call toString on the contained object.