Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Ive been searching for a while and can't seem to find what im looking for. What I want to do is write a python script to report problems and enforce code standards in Java code. Everything I have found so far has been things to translate java into python or python into java and that isn't really what I want. Im looking for a python library that can parse a multi-thousand class project and present the source itself in python in such a way where I can write rules something like
every class must have class level javadoc
every class must have a #primaryContactName tag in class level javadoc
every class must have a #primaryContactEmail tag in class level javadoc
the authorized 3rd party library list is {1,2,3,4,5} are any libraries other than this
list used
all lists and maps fully type safe.
bla bla bla
I reallize that I can get a great deal of this info from javac with very little effort, and I may investigate using javac to make version work, but im looking to do something a bit more advanced where I can build in real analytics
I have done similar with XDoclet in the past, but that was primarily used to mantain metadata in the source code about what systems it was accessing and such, nothing really to this analytics level im looking for now.
Anyone come across a python library that would help out with this? I would consider other languages (java, c, etc) its simply in my current situation, python is easier to work with than anything else.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I need to manipulate control flow graphs for Java code in a project. What might be a good java library to generate control flow graphs in Java. So far I have found a couple eclipse plugins (heavily dependent on eclipse APIs) and standalone tools (cannot embed in my code).
A tool to do this stuff is Soot, and this questions is a duplicate of Tool for generating control flow in Java
I'll throw another tool into the mix.
Atlas is an Eclipse plugin that enables program analysis. It has a querable graph database that includes the control flow graph (as well as data flow and other relationships).
jSonde will create sequence diagrams from your actual running code (which is arguably more useful than from source, since source analysis will not show implementation-specific functionality).
javacalltracer does something similar.
Most tools are integrated into Eclipse/similar so they have access to the AST, which makes such things pretty trivial.
It's actually not ridiculously complex to pull the information from byte code yourself (and it's an interesting exercise). Or instrument using AspectJ and create the runtime information yourself.
Edit Original answer, still valid.
JGraph is open-source, and pretty cool.
JDiagram is a Swing component, commercial product.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Can anybody help me by suggesting the name of an converter which converts C# code to Java code. Actually, I have a tool which is written in C# code and I am trying to modify it. As I have no idea about C# and .NET framework, it seems difficult to me to convert the large code by my own. I found from some web information that there exist some tools which can convert C# to Java (may not be properly, however they can). Can anybody help me by suggesting some name of those tools.
Disclaimer: No tool is perfect.
However, if you still want to try then there are these converters available:
CS2J
JCLA : Convert Java-language code to C#
Grasshopper
CSharpJavaMerger
Tangible Software C# to Java Converter
Not a converter but a bridge between .NET and the JVM:
JNI4NetBridge
You are better off doing it by hand. I've used code conversion software before, and it just mucks everything up. Sure, it corrects a few syntax differences, but largely what you'll get is just a mess of code that doesn't compile right away anyway.
With a converter you'll have to do a lot of corrections anyway. Why not take the small amount of extra time it will take to convert it by hand and end up with better code?
Even if you don't know C#, it will be better to learn it and do the conversion by hand, as I said before you will have to do it anyway. C# and Java are not too different syntactically, but as #Marc pointed out above, there are certainly gaps in the language. Simple C# is easily translated to Java, of course having to use the Java BCL instead of the .NET, which certainly have their differences. As you get into more complicated C#, there are things that have no direct equivalent.
Keep in mind, that conversion projects can be extremely time-consuming and are extremely effective at swallowing money in a business environment.
A google search will yield you some commercial options, but I'm not going to post them here, simply because I'm against that sort of thing. There are some things you just can't automatically translate.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Is there a Java equivalent of Python's "construct" library? I want to write "structs" like so:
message = Struct("message",
UBInt8("protocol"),
UBInt16("length"),
MetaField("data", lambda ctx: ctx["length"])
)
It doesn't have to specifically be a library with some sort of abstraction using the Java language. I mean, it could be a "portable" format, with an API for parsing the documents. I guess this could work out with XML, but it would be be a lot more ugly.
I realize I could just inter-operate with Python, but I don't want to do that.
I've looked a lot around and all I could find was Ragel (www.complang.org/ragel), that can also produce Java code.
It looked too complex for me so I've started some work to port Construct to Java.
I suspect it would be easier to make something like that in Scala, Groovy or JavaScript.
Construct on GitHub: https://github.com/MostAwesomeDude/construct
java construct: https://github.com/ZiglioNZ/construct
I've spent a couple of days on it, mostly looking for equivalents of python's expressive classes.
The most useful java classes I've found are: java.util.Scanner, java.util.Formatter and java.nio.ByteBuffer.
It's a big task so I want to focus on something small like creating simple parsers and formatters for ByteBuffers.
[Update]
I've ported enough code to parse and build some of the protocols that come with Python Construct, such as ethernet, arp and ipv4. Check it out at https://github.com/ZiglioNZ/construct
[Update: new Release]
Java Construct 1.1.2 is now available, see release notes.
You can use DataInput/DataOutput (and their implementations) to convert any set of values from/to a set of bytes. This doesn't give you an object where you can use names to access the individual fields, though - you would have to create such yourself.
It depends a bit on what you want to do - do you have a fixed data format to send/receive on wire, or does this vary from time to time?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
This question is a bit vague but I'd like to know if there's a Java tool that can run through my code and document it in a functional way. Is JavaDoc the only way to go, or are there alternatives?
JavaDoc is a good way of generating reference documentation. You can use custom doclets to adapt it to your needs (in look, functionality or extra bells-and-whistle) but it is still essentially still a list of methods and their descriptions.
Documenting enterprise software is more about documenting higher level stuff like design information, architecture, component interactions, etc. There's no software tool I know of that will do this for you automatically (reverse engineering tools will mostly produce a mess), but there are many content management systems that can help you organize and present it better.
You could also write a JavaDoc alternative (or use something existing) that uses reflection to analyze a class library and produce stuff, possibly with your help via annotations. For instance, there are research tools that let you place architectural constraints within your code, that are then used for conformance testing and possibly for documentation.
It all depends on what you want out of the generated documentation. JavaDoc is the standard way to do API documentation in Java, so that's probably your best starting point. There's actually a Doclet API if you just need to tweak the output. One example of the Doclet API in action is the UMLGraph doclet that can embed UML graphs in your JavaDoc output.
If you just hate JavaDoc, there's always things like Doxygen.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
What is the single best pretty-printing library for Java? I mean a library for printing formatted output with indentation, break hints, etc., not a library for beautifying/re-formatting Java code itself. Ideally, the library would "play nice" with System.out.println and friends.
For an idea of what I'm looking for, see OCaml's Format module, particularly Format.fprintf.
[UPDATE] I am not looking for a console windowing library. A pretty-printing library allows you to define methods for formatting arbitrary values such that indentation is preserved and line breaks are chosen at sensible locations. Such libraries exist for Haskell, Standard ML, OCaml, F#, and Scheme. The XTC library provides some of this functionality in xtc.tree.Printer, but it is not nearly as flexible as the libraries in other languages.
Is it jpplib?
Since you talk about boxes, break hints and so on I assume you mean to build a text-based windowing application. So I guess that you are looking for something similar to Ncurses but in Java. Maybe charva could help you.
You may also try javacurses.
According to Dr. Dobb's Code Talk it is cute.
I would say its still easier using Xalan + Sax, like in this example.