Re: [Jastadd] Problem with package-name clashes

From: Eric Bodden <eric.bodden_at_ec-spride.de>
Date: Fri, 11 Jan 2013 10:57:30 +0100

Hello.

I think the problem is in JastAdd but it only occurs on operating
systems that are case-insensitive in their file system, such as
Windows and OS X.

In ClassPath.jrag we have this code:

    private Collection filesInPackage(String packageName) {
      if(!map.containsKey(packageName)) {
        File f = new File(folder, packageName.replace('.', File.separatorChar));
        Collection c = Collections.EMPTY_LIST;
        if(f.exists() && f.isDirectory()) {
          String[] files = f.list();
          if(files.length > 0) {
            c = new HashSet();
            for(int i = 0; i < files.length; i++)
              c.add(files[i]);
          }
        }
        else
          c = null;
        map.put(packageName, c);
      }
      return (Collection)map.get(packageName);
    }

Crucially, on those OS's the calls to f.exists() && f.isDirectory()
return true also if the names don't match exactly.

I think ideally one should not at all look into the file system but
instead just look into the package declarations that exist.

Eric

On 10 January 2013 15:54, Jesper Öqvist <jesper.oqvist_at_cs.lth.se> wrote:
> Hi,
> I think that Soot might be using an older version of JastAddJ and that this
> bug has been fixed already.
>
> The bug sounds familiar though I have not found it yet in the bug tracker.
>
> I compiled the code you sent using the Java 5 and Java 7 backends. I did not
> try to run only semantic analysis, so I will try that.
>
> /Jesper
>
>
> On 01/10/2013 03:36 PM, Eric Bodden wrote:
>>
>> Hello.
>>
>>> The example project compiles fine with JastAddJ. I tried with the latest
>>> version and the Java 5 and 7 backends.
>>
>> I guess you mean "Java 5 and 7 frontends"?
>> Hmm this is odd.
>>
>>> Do you know what version of JastAddJ your soot uses?
>>
>> I am pretty sure it uses Java 5. Let me check again...
>>
>> Eric
>
>
> _______________________________________________
> JastAdd mailing list
> JastAdd_at_cs.lth.se
> https://mail1.cs.lth.se/cgi-bin/mailman/listinfo/jastadd



-- 
Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
Received on Fri Jan 11 2013 - 10:58:43 CET

This archive was generated by hypermail 2.3.0 : Wed Apr 16 2014 - 17:19:06 CEST