Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / September 2004

Tip: Looking for answers? Try searching our database.

Internal Compiler Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Reshma - 23 Apr 2004 07:36 GMT
I am getting the following error while trying to compile a J# file

Internal Compiler Error: f:\dd\vjsharp\sdk\bjdev\compiler\vjsc\codegen\attribute.cpp(219):

Can any one help m
Thanks

The code file is

// <Snippet1
import System.*
import System.Collections.*
import System.IO.*
import System.Xml.Serialization.*

public class Group
  /* Set the element name and namespace of the XML element
  By applying an XmlElementAttribute to an array,  you instruc
  the XmlSerializer to serialize the array as a series of XM
  elements, instead of a nested set of elements. *
 
  /** @attribute XmlElement(ElementName = "Members", Namespace = "http://www.cpandl.com"
   * *
  public Employee Employees[]
 
  /** @attribute XmlElement(DataType = "double", ElementName = "Building"
   * *
  public double GroupID
 
  /** @attribute XmlElement(DataType = "hexBinary"
   * *
  public ubyte HexBytes[]
 
 
  /** @attribute XmlElement(DataType = "boolean"
   * *
  public boolean IsActive
 
  /** @attribute XmlElement(Type = Manager.class
   * *
  public Employee Manager
 
  /** @attribute XmlElement(int.class, ElementName = "ObjectNumber"
   *  @attribute XmlElement(String.class, ElementName = "ObjectString"
   * *
  public ArrayList ExtraInfo
} //Grou

public class Employee
  public String Name
} //Employe

public class Manage
extends Employee
  public int Level
} //Manage

public class Run
 
  public static void main(String[] args)
     Run test =  new Run()
     test.SerializeObject("FirstDoc.xml")
     test.DeserializeObject("FirstDoc.xml")
  } //mai
 
 
 
  public void SerializeObject(String filename)
     // Create the XmlSerializer
     XmlSerializer s =  new XmlSerializer(Group.class.ToType())
   
     // To write the file, a TextWriter is required
     TextWriter writer = new StreamWriter(filename)
   
     /* Create an instance of the group to serialize, and se
        its properties. *
     Group group =  new Group()
     group.GroupID = 10.089
     group.IsActive = false
   
     group.HexBytes = new ubyte[]{Convert.ToByte(100)}
   
     Employee x =  new Employee()
     Employee y =  new Employee()
   
     x.set_Name("Jack")
     y.set_Name("Jill")
   
     group.Employees = new Employee[]{x, y}
   
     Manager mgr =  new Manager()
     mgr.set_Name("Sara")
     mgr.Level = 4
     group.Manager = mgr
   
     /* Add a number and a string to the
     ArrayList returned by the ExtraInfo property. *
     group.ExtraInfo = new ArrayList()
     group.ExtraInfo.Add(42)
     group.ExtraInfo.Add("Answer")
   
     // Serialize the object, and close the TextWriter.    
     s.Serialize(writer, group)
     writer.Close()
  } //SerializeObjec
 
 
  public void DeserializeObject(String filename)
     FileStream fs =  new FileStream(filename, FileMode.Open)
     XmlSerializer x =  new XmlSerializer(Group.class.ToType())
     Group g = ((Group)(x.Deserialize(fs)))
     Console.WriteLine(g.Manager.get_Name())
     Console.WriteLine(g.GroupID)
     Console.WriteLine(g.HexBytes.get_Item( 0))
     for(int iCtr =0;iCtr < g.Employees.length;iCtr++
     
         Employee e = g.Employees[iCtr]
        Console.WriteLine(e.get_Name())
     
  } //DeserializeObjec
} //Ru

// </Snippet1
Lars-Inge T?nnessen - 27 Apr 2004 15:37 GMT
> Can any one help me

I can make it work. Please see " // HERE____" in your code. Now it compiles
and runs.

This line gives you the internal error:

  /** @attribute XmlElement(Type = Manager.class)   * */
  public Employee Manager;

Change it to:

   /** @attribute XmlElement(Manager.class, ElementName = "Manager") */
  public Employee Manager;

You have a few extra problems too I corrected for you.  =:o)

import System.*;
import System.Collections.*;
import System.IO.*;
import System.Xml.Serialization.*;

public class Group
{
   /** @attribute XmlElement(ElementName = "Members", Namespace =
http://www.cpandl.com) */
   public Employee Employees[];

   /** @attribute XmlElement(DataType = "double", ElementName = "Building")
*/
   public double GroupID;

   /** @attribute XmlElement(DataType = "hexBinary") */
   public ubyte HexBytes[];
   /** @attribute XmlElement(DataType = "boolean") */
   public boolean IsActive;

// HERE_____________
   /** @attribute XmlElement(Manager.class, ElementName = "Manager") */
   public Employee Manager;
// _________________

   /** @attribute XmlElement(int.class, ElementName = "ObjectNumber")
   * @attribute XmlElement(String.class, ElementName = "ObjectString") */
   public ArrayList ExtraInfo;
} //Group

public class Employee
{
   public String Name;
} //Employee

public class Manager extends Employee
{
   public int Level;
} //Manager

public class Runq
{
   public void SerializeObject(String filename)
   {

       // Create the XmlSerializer.
       XmlSerializer s = new XmlSerializer(Group.class.ToType());

       // To write the file, a TextWriter is required.
       TextWriter writer = new StreamWriter(filename);

       /* Create an instance of the group to serialize, and set its
properties. */
       Group group = new Group();
       group.GroupID = 10.089;
       group.IsActive = false;
       group.HexBytes = new ubyte[]{Convert.ToByte(100)};
       Employee x = new Employee();
       Employee y = new Employee();

// HERE_______
       x.Name = new String("Jack");
       y.Name = new String("Jill");
// ___________

       group.Employees = new Employee[]{x, y};
       Manager mgr = new Manager();

// HERE _____
       mgr.Name = new String("Sara");
// __________

       mgr.Level = 4;
       group.Manager = mgr;

       /* Add a number and a string to the ArrayList returned by the
ExtraInfo property. */
       group.ExtraInfo = new ArrayList();

// HERE________
       group.ExtraInfo.Add( (System.Int32)(42) );
       group.ExtraInfo.Add("Answer");
// ____________

       // Serialize the object, and close the TextWriter.

// HERE____
       try
       {
           s.Serialize(writer, group);
           writer.Close();
       }
       catch ( System.InvalidOperationException invalid )
       {
           System.Console.WriteLine( "Exception: "+invalid);
       }
// _______

   } //SerializeObject

   public void DeserializeObject(String filename)
   {
       FileStream fs = new FileStream(filename, FileMode.Open);
       XmlSerializer x = new XmlSerializer(Group.class.ToType());
       Group g = ((Group)(x.Deserialize(fs)));
       Console.WriteLine(g.Manager.Name);
       Console.WriteLine(g.GroupID);
       Console.WriteLine(g.HexBytes.get_Item( 0));
       for(int iCtr =0;iCtr < g.Employees.length;iCtr++)
       {
           Employee e = g.Employees[iCtr];

// HERE______
       Console.WriteLine(e.Name);
// __________

       }
   } //DeserializeObject

   public static void main(String[] args)
   {
       Runq test = new Runq();
       test.SerializeObject("FirstDoc.xml");
       test.DeserializeObject("FirstDoc.xml");
   }
}

Regards,
Lars-Inge T?nnessen
www.larsinge.com
Diganta Roy[MSFT] - 08 Sep 2004 11:54 GMT
This issue has been fixed in Visual Studio .NET 2005 - currently its in
Beta1.

Note that you need to access the fields in the class Employee as x.Name and
not as x.get_Name() or x.set_Name; as "Name" is a field and not a property.

Thanks,
Diganta Roy
Microsoft Visual J# .NET Product Team

This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

--------------------
>Reply-To: "Lars-Inge T?nnessen" <http://emailme.larsinge.com>
>From: "Lars-Inge T?nnessen" <http://emailme.larsinge.com>
[quoted text clipped - 10 lines]
>NNTP-Posting-Host: stud-064.vpn.uit.no 129.242.154.197
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.vjsharp:5964
>X-Tomcat-NG: microsoft.public.dotnet.vjsharp
[quoted text clipped - 146 lines]
>Lars-Inge T?nnessen
>www.larsinge.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.