logo       

Nice/src/bossa/syntax MethodBodyDefinition.java,1.152,1.153: msg#00033

Subject: Nice/src/bossa/syntax MethodBodyDefinition.java,1.152,1.153
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10104/src/bossa/syntax

Modified Files:
        MethodBodyDefinition.java 
Log Message:
Give an explicit error message when an implementation is rejected because
it uses a wrong parameter name.


Index: MethodBodyDefinition.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v
retrieving revision 1.152
retrieving revision 1.153
diff -C2 -d -r1.152 -r1.153
*** MethodBodyDefinition.java   15 Sep 2004 00:47:31 -0000      1.152
--- MethodBodyDefinition.java   11 Oct 2004 12:34:27 -0000      1.153
***************
*** 115,119 ****
    }
  
!   /** 
        Returns the symbol of the method this declaration belongs to.
     */
--- 115,139 ----
    }
  
!   private static class ErrorList
!   {
!     private List errors = null;
!     boolean multipleErrors = false;
! 
!     void add(MethodDeclaration method, UserError error)
!     {
!       if (errors == null)
!         errors = new ArrayList();
! 
!       errors.add(error);
!     }
! 
!     void report()
!     {
!       if (errors != null && errors.size() == 1)
!         throw (UserError) errors.get(0);
!     }
!   }
! 
!   /**
        Returns the symbol of the method this declaration belongs to.
     */
***************
*** 130,135 ****
  
      // Try to remember what caused the error when no symbol could be found.
!     UserError error = null;
!     boolean multipleErrors = false;
  
      for(Iterator i = symbols.iterator(); i.hasNext();){
--- 150,154 ----
  
      // Try to remember what caused the error when no symbol could be found.
!     ErrorList errorList = new ErrorList();
  
      for(Iterator i = symbols.iterator(); i.hasNext();){
***************
*** 172,181 ****
              }
              catch (TypingEx e) {
!               if (error == null)
!                 error = new UserError(formals[p],
!                                       "Pattern " + formals[p] +
!                                       " is incompatible with " + domain[p]);
!               else
!                 multipleErrors = true;
  
                throw e;
--- 191,199 ----
              }
              catch (TypingEx e) {
!               errorList.add
!                 (m,
!                  new UserError(formals[p],
!                                "Pattern " + formals[p] +
!                                " is incompatible with " + domain[p]));
  
                throw e;
***************
*** 199,203 ****
       * then try to find the most specific declaration(s) using these tc's
       * TODO: combine this code with removeNonMinimal in OverloadedSymbolExp
!      */   
      if (symbols.size() > 1 && hasAdditionalTags)
        {
--- 217,221 ----
       * then try to find the most specific declaration(s) using these tc's
       * TODO: combine this code with removeNonMinimal in OverloadedSymbolExp
!      */
      if (symbols.size() > 1 && hasAdditionalTags)
        {
***************
*** 255,258 ****
--- 273,280 ----
            if (formals[i].atAny() && formals[i].name != null && 
params.getName(i) != null &&
                
!formals[i].name.toString().equals(params.getName(i).toString())) {
+             errorList.add(m,
+                           new UserError(formals[i], "Parameter " + formals[i] 
+
+                                         " should be called " +
+                                         params.getName(i)));
            it.remove();
            continue outer;
***************
*** 268,277 ****
      if (symbols.size() == 0)
        {
!         if (error != null && ! multipleErrors)
!           throw error;
!         else
!           User.error(this,
!                      "No method called " + name +
!                      " is compatible with these patterns");
        }
  
--- 290,299 ----
      if (symbols.size() == 0)
        {
!         errorList.report();
! 
!         // Default message in case we could not produce a better one.
!         User.error(this,
!                    "No method called " + name +
!                    " is compatible with these patterns");
        }
  



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe