M
Miguel Farah
I need to create a barebones version of my Java source files.
What I mean when I say "barebones" is this: I have, for example, this class:
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
package cl.cl.cl;
import cl.lc.*;
import java.util.*;
public class demo {
public String salute="Hello, World!";
private String somethingElse="";
public void SayHello() {
System.out.println(":::"+salute+":::");
// ... a lot of code ...
}
public int RealAge(Person p) {
// ... a lot of code ...
return theStuffIJustCalculated;
}
public Person[] Friends(Person p) {
// ... a lot of code ...
return theArray[];
}
}
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
The barebones version would be:
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
package cl.cl.cl;
import cl.lc.*;
import java.util.*;
public class demo {
public String salute="Hello, World!";
public void SayHello() { }
public int RealAge(Person p) { return 0; }
public Person[] Friends(Person p) { return null; }
}
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
It would keep all the public/protected (not the private) attributes, methods,
etcetera, but only the declarations and no code inside the methods. The methods
that return something return a zero or a null value.
My intention is to be able to compile the entire set of source files, even if
there isn't any "meat" in them.
I wrote a Perl script, using pattern matching, but it's pretty crude and won't
handle properly stuff like more than one modifier for an attribute or a method,
or inner classes.
I'm wondering if this has been solved before. Do you know about a tool that does
what I'm trying to do?
Thanks in advance.
What I mean when I say "barebones" is this: I have, for example, this class:
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
package cl.cl.cl;
import cl.lc.*;
import java.util.*;
public class demo {
public String salute="Hello, World!";
private String somethingElse="";
public void SayHello() {
System.out.println(":::"+salute+":::");
// ... a lot of code ...
}
public int RealAge(Person p) {
// ... a lot of code ...
return theStuffIJustCalculated;
}
public Person[] Friends(Person p) {
// ... a lot of code ...
return theArray[];
}
}
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
The barebones version would be:
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
package cl.cl.cl;
import cl.lc.*;
import java.util.*;
public class demo {
public String salute="Hello, World!";
public void SayHello() { }
public int RealAge(Person p) { return 0; }
public Person[] Friends(Person p) { return null; }
}
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
It would keep all the public/protected (not the private) attributes, methods,
etcetera, but only the declarations and no code inside the methods. The methods
that return something return a zero or a null value.
My intention is to be able to compile the entire set of source files, even if
there isn't any "meat" in them.
I wrote a Perl script, using pattern matching, but it's pretty crude and won't
handle properly stuff like more than one modifier for an attribute or a method,
or inner classes.
I'm wondering if this has been solved before. Do you know about a tool that does
what I'm trying to do?
Thanks in advance.