Questions tagged [compilationunit]

27 questions
23
votes
3 answers

How is compilation unit defined in c++?

Possible Duplicate: What is a “translation unit” in C++ It is often said that the static variables declared in C/C++ are not visible across compilation units ? Does this mean that each .c or .cpp file is a separate compilation unit ? What about a…
cppdev
  • 6,833
  • 13
  • 40
  • 45
7
votes
1 answer

Eclipse Java Compiler Warnings as ant task

I want the eclipse Java Compiler Warnings available as an ant task (ie without eclipse) - ideally as ant plugins - but I want the cruise control ant task to fail if an eclipse warning shows up. For the following warnings Non-static access to static…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
5
votes
1 answer

Eclipse create CompilationUnit from .java file

How can I load a .java file into a CompilationUnit? For example, lets say I have a A.java file in my current project. I would like to load it into a CompilationUnit and then pass it to the ASTParser. It is not an option just to load it as a plain…
zpavlinovic
  • 1,507
  • 1
  • 17
  • 36
4
votes
3 answers

Eclipse Abstract Syntax Tree Diff

Given the following code in Eclipse: import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTParser; import org.eclipse.jdt.core.dom.CompilationUnit; public class Question { public static void main(String[] args) { …
hawkeye
  • 34,745
  • 30
  • 150
  • 304
4
votes
3 answers

Are multiple compilation units still worthwhile when (execution time) >>> (compile time)?

Based on my understanding, the chief benefits of creating a program with multiple compilation units are reusability of components and shorter compile times when incorporating small changes. I also think (possibly wrongly) that there is a penalty…
user1476176
  • 1,045
  • 1
  • 7
  • 15
3
votes
1 answer

Eclipse create CompilationUnit handle from String

My question is similar to Eclipse create CompilationUnit from .java file however I don't have a file and I would like to create a handle for a CompilationUnit with given contents without actually creating underlying resources. The actual goal is to…
Danny Lo
  • 1,553
  • 4
  • 26
  • 48
3
votes
2 answers

Generate bytecode from Eclipse's CompilationUnit

I am not working on an Eclipse plug-in project; however, I use an external library that generates an instance of org.eclipse.jdt.core.dom.CompilationUnit. Is there a way to generate Java bytecode from it? Some searching revealed that…
Oak
  • 26,231
  • 8
  • 93
  • 152
3
votes
2 answers

Can inline member functions differing across compilation units break binary compatibility?

I have a lot of code in a big project that has two general types of code, some that is done in a nice C++ style and has been code reviewed by an expert in C++ and some that is not and has not. The code that is not has lots of for loops and…
Chris A.
  • 6,817
  • 2
  • 25
  • 43
2
votes
2 answers

Java file naming restriction

Actually I was going through The Java Language Specification and I found a strange sentence from which I couldn't come to a conclusion. Since I'm not a native English speaker. If and only if packages are stored in a file system (§7.2), the host…
MRM
  • 165
  • 6
2
votes
1 answer

Are non-compilation units in the unnamed package of a named module open?

I could not find any mention of this in the JLS, it only talks about how compilation units are placed in the unnamed module when they are in the unnamed package. Background: Many libraries require user code to put a configuration file with a…
2
votes
3 answers

Ada, check out my package. ("compilation unit expected"?)

I've gotten rid of all my other compile-time errors except "compilation unit expected", which starts right after my import statements. I'm guessing I need to create a package? And if so, how do I do it? I have a few functions all living in the same…
Old McStopher
  • 6,295
  • 10
  • 60
  • 89
2
votes
1 answer

JavaParser doesn't update source file

I'm using JavaParser and following its Wiki. Problem is even though I change the method's name and add a parameter to it, the file doesn't update. In other words, changes are not saved. When I System.out.println the changed CompilationUnit, it…
2
votes
1 answer

Extracting AST from JAVA and printing the AST to a file

I'm a beginner to the Java programming language. I want to extract the AST from java source code and print the AST to a file or standard output. I followed this tutorial to learn how to work with…
2
votes
1 answer

GWT compiler - compilation units and interfaces

This question is based on an answer I received for another question : https://stackoverflow.com/a/3060233/323357 My understanding is that the use of interfaces to declare return types and parameters types in my services forces the compiler to…
Garagos
  • 588
  • 1
  • 4
  • 16
1
vote
1 answer

Use JDT to extract IcompilationUnits in a standalone Java application

I am writting an ordinary Java application and want to extract all ICompilationUnit of an input project (which is not necessary developed by Eclipse). As I am not developing an Eclipse plugin, I can't use the below code to extract…
Arash
  • 11
  • 1
1
2