Questions tagged [code-generation]

Topics related to the generation of code as the output of an application, instead of directly writing code by a programmer.

3642 questions
22
votes
2 answers

How to debug/break in codedom compiled code

I have an application which loads up c# source files dynamically and runs them as plugins. When I am running the main application in debug mode, is it possible to debug into the dynamic assembly? Obviously setting breakpoints is problematic, since…
Jason Coyne
  • 6,509
  • 8
  • 40
  • 70
22
votes
3 answers

Using types in a T4 template that exist in the same project as the template

I'm working on my first T4 code generation tool to add some Stored Procedure helper code to my project. I've created custom types (e.g. StoredProcedure and StoredProcedureParameter to help with my code generation and have included the assembly and…
Ben McCormack
  • 32,086
  • 48
  • 148
  • 223
22
votes
8 answers

Is there a shortcut for adding fields to existing constructor in Eclipse?

Is there any shortcut in Eclipse that allows me to add a field to the argument list of an existing constructor? Example: I hava this class: public class A { int a; int b; public A(int a, int b) { this.a = a; this.b = b; …
Philipp Sander
  • 10,139
  • 6
  • 45
  • 78
22
votes
5 answers

Template based C / C++ code generation

Any suggestion for template base code generator for C / C++ specifically to generate repetitive code generation? (Not UML / MATLAB model based or other advanced stuff). For a newbie in this field any good generic tutorial (not tool based)? I came…
Kamath
  • 4,461
  • 5
  • 33
  • 60
22
votes
2 answers

How do I generate C# code from WADL files?

I am looking for a code generator than can generate C# code to access RESTful web services described by WADL files in a way similar to how wadl2java works. Doing som searching I came across the rest-api-code-gen project on Google Code, but although…
Anders Sandvig
  • 20,720
  • 16
  • 59
  • 73
22
votes
1 answer

Auto-generate stub methods that throw in eclipse

Similar to How to change "Generate Method Stub" to throw NotImplementedException in VS?, but for Eclipse instead of Visual Studio Both NetBeans and Eclipse have a function that, if you declare a Java class to implement an interface but omit one or…
finnw
  • 47,861
  • 24
  • 143
  • 221
21
votes
4 answers

Java source code parsers/generators

I need tools to: Conveniently parse Java source code and easily access given elements. Easily generate source code files, to easily transform data structures into code Any good tips, libraries, frameworks, tools? Thank you for help.
Jarek
  • 7,425
  • 15
  • 62
  • 89
21
votes
12 answers

What are the best Java code generation tools or plugins to use in Eclipse?

I'm aware of the built in code generation and refactoring one can do with the "Source" and "Refactor" menu items in Eclipse. I also use the Commonclipse plugin to easily make use of the Apache Commons classes that build hashCode, toString, equals…
Chinnery
  • 10,179
  • 2
  • 23
  • 25
21
votes
2 answers

Is Project Lombok suitable for large java projects?

Is anybody out there using Project Lombok for a large scale production system? How does it influence your compile process (i.e. does it do two-pass compilation, slow it down, make it more fragile)?
Jacob
  • 22,785
  • 8
  • 39
  • 55
21
votes
4 answers

How are exceptions caught and dealt with at the low (assembly) level?

I have this code - try { doSomething(); } catch (Exception e) { e.printStackTrace(); } How will this actually be implemented by the compiler. Where is the check for the exception actually put in the assembly code generated? Update I know…
pdeva
  • 43,605
  • 46
  • 133
  • 171
21
votes
3 answers

GHC code generation for type class function calls

In Haskell to define an instance of a type class you need to supply a dictionary of functions required by the type class. I.e. to define an instance of Bounded, you need to supply a definition for minBound and maxBound. For the purpose of this…
ErikR
  • 51,541
  • 9
  • 73
  • 124
21
votes
3 answers

Generating LLVM Code from Java

I want to use the LLVM code generation Framework from Java. I.e., I do not want to compile Java code into LLVM. I simply want an LLVM library for code generation that I can call from Java. The usual LLVM library is C, so I cannot use it. Are there…
gexicide
  • 38,535
  • 21
  • 92
  • 152
21
votes
1 answer

Generating Clojure code with macro containing type hints

I'm trying to generate some Clojure code with type hints, however the type hints seem to disappear whenever I build some code (they also don't function when the code is compiled) e.g. `(let [^BufferedImage b (create-buffered-image)] (.getRGB b 0…
mikera
  • 105,238
  • 25
  • 256
  • 415
20
votes
11 answers

Generating classes automatically from unit tests?

I am looking for a tool that can take a unit test, like IPerson p = new Person(); p.Name = "Sklivvz"; Assert.AreEqual("Sklivvz", p.Name); and generate, automatically, the corresponding stub class and interface interface IPerson // inferred…
Sklivvz
  • 30,601
  • 24
  • 116
  • 172
20
votes
1 answer

Python packaging: Generate a python file at installation time, have this work with tox

I want to generate a python file at installation time. I want this work with both python setup.py develop, python setup.py install and pip install. So far so good. However I also want this to work with tox. This is where I am having problems. The…
Att Righ
  • 1,439
  • 1
  • 16
  • 29