db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: generated code in derby
Date Tue, 15 Oct 2013 14:09:30 GMT
On 10/15/13 5:09 AM, Jonathan Bernwieser wrote:
> Hi there,
> I am currently doing my Bachelor thesis at TU Munich, at the Software Engineering chair
of Prof. Broy.   
>      
>
> The goal of this thesis is to create a tool to automatically 
> categorize source code in open source software. Different categories 
> will be “test code”, “generated code” and “productive code” to better 
> evaluate and use the results of quality-check techniques. (Static 
> analyses might detect certain quality problems even though they’re not 
> relevant for a certain code category. One example would be the amount 
> of clones found in a project. It has to be checked what kind of 
> category the evaluated code belongs to as clones aren’t causing 
> quality issues if they occur in “generated code”.)
>
>      
>
> In order to create and test heuristics to identify code categories, I 
> first need to create manually a collection of different projects (or 
> classes to be more specific) I actually know about what kind of 
> category they belong to.
>
> While manually going through the derby project I found generated files 
> in the following directories:
>
> ·derby\derby-10.6.1.0\src\db-derby-10.6.1.0-src\java\engine\org\apache\derby\impl\sql\compile\

>
>
> ·derby\derby-10.6.1.0\src\db-derby-10.6.1.0-src\java\tools\org\apache\derby\impl\tools\ij\

>
>
> Are there any other generated classes I didn’t recognize?
>
> Thanks you for your help.   
> Looking forward to hearing from you,   
>      
> Regards,   
>     
>      
> Jonathan   
>
Hi Jonathan,

The term "generated code" is overloaded with many meanings. This term 
can be applied to several kinds of code associated with Derby:

1) The code generated into the "generated" subdirectory when Derby is 
built. This code includes

a) The code generated by javacc from Derby's SQL dialect (found in 
generated/java/org/apache/derby/impl/sql/compile)

b) The code generated by javacc for Derby's ij tool (found in 
generated/java/org/apache/derby/impl/tools/ij)

c) Some shell scripts copied to generated/bin

d) A list of class sizes used to estimate memory usage at run time: 
generated/java/org/apache/derby/iapi/services/cache/ClassSizeCatalogImpl.java

e) The English message source generated by 
org.apache.derbyBuild.MessageBuilder from 
java/engine/org/apache/derby/loc/messages.xml. The English message 
source is generated into 
generated/java/org/apache/derby/loc/messages_en.properties

f) Debug information generated into 
generated/java/org/apache/derby/shared/common/sanity.

g) A demo database generated into generated/toursdb


2) Optimized chunks of localized message files are generated by the 
localeinfo target of the Derby build into files which have names of the 
form 
classes/org/apache/derby/loc/m${partitionNumber}_${languageCode}_${countryCode}.properties

3) Compiled SQL queries, which include generated Java byte code. The 
byte code is generated into memory in the org.apache.derby.exe package 
space. This byte code is generated by Derby in production. In some 
cases, this code is stored in an invisible column of SYS.SYSSTATEMENTS.

4) SQL text which is generated by Derby in production for certain 
operations like bulk import.

The generated code you have found corresponds to items (1a) and (1b) above.

Hope this helps,
-Rick


Mime
View raw message