Ajuste de Código Java

Geração & Re-estruturação de Código

  • XDoclet
    XDoclet é um mecanismo de geração de código. Ele provê Programação Orientada a Atributos para Java. Em resumo, isso significa que você pode adicionar mais significância ao seu código adicionando meta dados (atributos) em seus fontes java. Isto é feito através de tags JavaDoc especiais. Atualmente XDoclet pode ser usado somente como parte do processo de build utilizando Jakarta Ant. Embora XDoclet tenha se originado como uma ferramenta para criação de EJBs, evoluiu para um mecanismo de geração de código de propósito geral. XDoclet é open source desenvolvido por um grupo de especialistas espelhados no mundo e distribuído sob uma licença flexível BSD.
    Projeto SourceForge: xdoclet.
  • JRefactory
    JRefactory is a tool that allows you to perform many package, class and method refactorings. JRefactory also includes other useful related tools: Pretty Printer/Beautifier, UML Diagrams, Printing, Coding Standards checking, BugFinding, Metrics, among others. The software is free, created by Chris Seguin and now maintained by Mike Atkinson. Currently supported IDEs: jEdit, NetBeans 3.6, JBuilder X, Stand-alone, Ant.

Análise de Qualidade de Código, Métricas e Detecção de Problemas

  • Glean
    Glean é um framework de scripts Ant para geração de feedback sobre o código fonte de uma equipe. O objetivo de Glean é tornar possível adicionar retorno sobre seu ciclo de construção (build) com o mínimo de esforço. Os scripts acionam ferramentas livres (open source) e coletam o HTML resultante para que você publique em um website do projeto ou alguma outra área comum do desenvolvimento. Um dashboard coleta as métricas chave resultantes de diversas ferramentas executadas e as apresenta em uma página HTML de resumo.
    Ferraentas suportadas: Spring beandoc, Checkstyle, Cobertura, PMD & CPD (Copy/Paste Detector), dbdoclet, doccheck, Emma, FindBugs, jaranalyzer, java2html14, java2html15, javadoc, JavaNCSS, jdepend, JUnitreport, QALab, SchemaSpy, statCVS, statSVN, UMLgraph-doc, UMLgraph-views.
  • QALab - Statistics for your Build
    Consolida dados de ferramentas de QA como Checkstyle, PMD, FindBugs, Cobertura (cobertura-branch, cobertura-line), Emma e Simian em um formato genérico qalab.xml, e gera gráficos e páginas de resumo (XML, HTML).
  • PMD
    PMD scans Java source code and looks for potential problems like: Possible bugs, dead code, suboptimal code, Overcomplicated expressions, Duplicate code. PMD is integrated with many Java IDEs: Eclipse, NetBeans, JDeveloper, JBuilder, BlueJ, JEdit, Gel, Emacs.
    PMD Copy-Paste Detector (CPD).
  • FindBugs
    FindBugs is a program which looks for bugs in Java code. It is free software, distributed under the terms of the Lesser GNU Public License. FindBugs requires JRE (or JDK) 1.4.0 or later to run. However, it can analyze programs compiled for any version of Java.
    The name FindBugs™ and the Findbugs logo are trademarked by The University of Maryland. FindBugs is sponsored by Fortify Software.
    Eclipse IDE plugin for FindBugs also provided.
  • Simian
    Simian (Similarity Analyser) identifies duplication in Java, C#, C, CPP, COBOL, JSP, HTML source code and even plain text files. Simian can be used as part of the build process during development or re-factoring to assist in raising the quality of your software.
  • JavaNCSS - A Source Measurement Suite for Java
    JavaNCSS é um utilitário simples em linha de comando que mede métricas padrão de código fonte para a linguagem de programação Java. As métricas podem ser coletadas globalmente, para cada classe e/ou para cada função. São contados: Pacotes, Classes, Métodos, NCSS (Non Commenting Source Statements, linhas de código efetivo/não-comentário).
  • CAP - Code Analysis Plugin
    CAP is a plugin for the Eclipse platform and analysis the dependencies of your Java project. It opens a own perspective and displays the results in a clear way using different diagrams.
  • Eclipse Metrics plugin Provide metrics calculation on Java code and dependency analyzer plugin for the Eclipse platform.
    This metrics plugin calculates various code and design metrics for Java projects — such as McCabe cyclomatic complexity and the dependency metrics of Robert Martin and many others —, with average and standard deviation; detect cycles in package and type dependencies and graph them. It also includes a graphical dependency analysis tool based on the dynamic hyperbolic graphing package TouchGraph.
    Metrics at SourceForge.
  • SourceMonitor
    O programa freeware SourceMonitor permite a você ver dentro do código fonte do software para saber quanto código você realmente tem e identificar a complexidade relativa dos módulos. Por exemplo, você pode usar SourceMonitor para identificar o código com maior probabilidade de conter defeitos e portanto requer revisão formal. SourceMonitor, escrito em C++, percorre seu código em um único passo a alta velocidade (tipicamente, pelo menos 10.000 linhas de código por segundo), coletando métricas através de arquivos fonte escritos em C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) ou HTML. Ele salva, exporta (XML, CSV), exibe e imprime métricas em tabelas e gráficos, inclusive diagramas Kiviat. Operates within a standard Windows GUI or inside your scripts using XML command files.

Estilo & Padronização de Código

  • Java Checkstyle
    Checkstyle é uma ferramenta de desenvolvimento para ajudar programadores a escrever código Java que obedece um padrão de codificação. Ele automatiza o processo de verificação de código-fonte Java para liberar humanos dessa enfadonha (mas importante) tarefa. Isto torna o Checkstyle ideal para projetos Java amplos onde se pretende adotar um padrão único de codificação. Ele suporta por padrão básico as Convenções de Código da Sun. Entretanto, Checkstyle é altamente configurável.
    eclipse-cs: Checkstyle Plug-in for Eclipse IDE.
  • Jalopy
    Java Source Code Formatter, Beautifier, Pretty Printer.
    Jalopy é um formatador de código fonte para a linguagem de programação Java. Ele ajusta o alinhamento e valida código-fonte Java de acordo com regras, que são altamente configuráveis. Visa obter um determinado estilo ou padrão de codificação sem colocar a obrigação de formatação sobre desenvolvedores individualmente. Com Jalopy você será capaz de transformar qualquer estilo de codificação externo em suas próprias preferências, sem nenhuma dificuldade ou perda de tempo.
    Jalopy é "Software Código Aberto Certificado OSI", distribuído sob Licença BSD.
    Jalopy versão comercial, por TRIEMAX Software.
  • Artistic Style
    A Free, fast and small Automatic Indentation Filter for C, C++, C#, and Java Source Codes, by Tal Davidson, Israel.
    Projeto SourceForge: astyle.
  • Jindent
    Jindent é um Formatador e embelezador de código-fonte Java, com recurso de impressão formatada (Pretty printer). Produto comercial.
  • Jacobe - Java Code Beautifier
    Jacobe is a configurable code beautifier for the Java programming language. It is possible to let Jacobe print your Java code according to the widely used layout rules of Sun Microsystems, or customize it to your own standards. Jacobe for Linux and Windows are free. Jacobe for Solaris has a commercial licence. By TIOBE Software.
  • JPretty - Java Source Code Beautifier
    JPretty is a Java source beautifier.  It takes a syntactically correct Java program  and reformats it according to specified options. Produto comercial.
  • Google Web Directory: Programming Languages: Java Development Tools
    Ant, Applet Development, Code Beautifiers, Code Exploring and Managing, Code Refactoring, Debugging, Deployment, Design and Modelling, Integrated Development Environment (IDE), Micro, Obfuscators, Performance and Testing, Translators.
    Java Code Beautifiers.

Análise de Desempenho - Profiling

  • Java Performance Tuning
    Dicas de calibração, análise de ferramentas, artigos, listagem e análise de livros, e outros recursos. Por Fasterj.com.
  • NetBeans Profiler (open source)
    NetBeans Profiler pe um NetBeans para prover funcionalidade de profiling com plenos recursos para o IDE NetBeans.
  • Eclipse Test & Performance Tools Platform (TPTP) (open source)
    TPTP is an open source top-level Project of the Eclipse Foundation, divided into four projects: TPTP Platform, Monitoring Tools, Testing Tools, Tracing and Profiling Tools.
  • JProbe (comercial)
    Por Quest Software. JProbe é um profiler Java de nível corporativo provendo uma console integrada para diagnóstico inteligente de uso de memória (memory leaks e object cycling), desempenho (gargalos e deadlocks) e cobertura de testes (QA), permitindo desenvolvedores e administradores apontar e reparar a causa raiz de problemas de desempenho e estabilidade no código da aplicação.
  • JProfiler (comercial)
    JProfiler is an award-winning all-in-one Java profiler. Its GUI helps to find performance bottlenecks, pin down memory leaks and resolve threading issues. Por ej-technologies.
  • Borland SilkPerformer (comercial)
    Performance e load testing para aplicações de software em Java e .NET e para web services. Por Borland - Application Lifecycle Management (ALM).
  • YourKit Java Profiler (comercial)
    YourKit Java Profiler do both CPU and memory profiling, where one can profile even huge applications with high productivity and very low overhead.
  • Need for speed -- Eliminating performance bottlenecks
    Optimizing Java Programs Using IBM Rational Application Developer 6.0.1. Article by Satish Chandra Gupta Rational Software, IBM, 04 Oct 2005, updated 10 Nov 2005. IBM developerWorks - Rational Java technology.
    Veja também: Rational Application Developer for WebSphere, IBM Rational Software Development Platform, IBM Rational Software (comercial).
  • DevPartner Java Edition (comercial)
    Por Micro Focus. Tune, test and analyze the design of Java applications.
  • HP OpenView Transaction Analyzer (comercial)
    Monitor, analyze and profile J2EE and .NET applications in live production and test environments.
  • JMP - Java Memory Profiler (open source)
    JMP is a profiler for java that can be used to trace objects usage and method timings. JMP uses the JVMPI interface to gather statistics and interact with the JVM. JMP uses a GTK+ interface to show the status. Runs on Linux and Windows (Cygwin).
  • Performance analysis
    Análise de desempenho em engenharia de software. Por Wikipedia, the free encyclopedia.

Testes de Implementação

  • Open source Java developer testing tools
  • In pursuit of code quality: JUnit 4 vs. TestNG
    Why TestNG is still the better framework for large-scale testing. By Andrew Glover, President, Stelligent Incorporated, 2006-08-29, IBM developerWorks Java Technology.
  • Java Test Frameworks: JUnit and TestNG (PDF)
    By Kedar Mhaswade, 2006.
  • Veja: JUnit
  • TestNG
    Next Generation Java Testing. TestNG is a testing framework inspired from JUnit and NUnit, but introducing some new functionalities that make it more powerful and easier to use. TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration etc.
  • JTiger
    JTiger Unit Testing Framework for Java SE 5+ is an open source solution that provides a robust and feature-rich abstraction to develop and execute unit test cases. Test case metadata and unit test documentation is expressed through annotations. Assertions, from the basic to the complex, can be made using the JTiger assertions package rather than having to write the logic for those assertions yourself.
  • Java Application Verification Kit (AVK) for the Enterprise
    The Java Application Verification Kit (AVK) for the Enterprise is a tool intended to help developers test their applications for correct use of J2EE APIs and portability across J2EE compatible application servers, and to help developers avoid inadvertently writing non-portable code.
    Java Application Verification Kit (AVK) for the Enterprise 1.4 FCS - Download.
  • HttpUnit
    Written in Java, HttpUnit emulates the relevant portions of browser behavior, including form submission, JavaScript, basic HTTP authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links. When combined with a framework such as JUnit, it is fairly easy to write tests that very quickly verify the functioning of a web site.
    SourceForge: HttpUnit.
  • jWebUnit
    jWebUnit is a Java framework that facilitates creation of acceptance tests for web applications. It evolved from a project where we were using HttpUnit and JUnit to create acceptance tests. As the tests were being written, they were continuously refactored to remove duplication and other bad smells in the test code. jWebUnit is the result of these refactorings.
    SourceForge: jWebUnit.
  • JMockIt
    JMockIt is a Java class library for developer testing with "mock methods". JMockit consists of a single class with a small set of static methods, which allow arbitrary methods and constructors of any other class to be replaced by mock implementations at runtime. JMockIt is open source software released under The MIT License.
  • Mock Objects
    Mock Objects, a technique for improving the design of code within Test-Driven Development.

JUnit

  • JUnit
    JUnit is a simple framework to write repeatable tests in/for Java. It is an instance of the xUnit architecture for unit testing frameworks.
  • JUnit.org
    This site is dedicated to software developers using JUnit or one of the other XUnit testing frameworks.
  • Java Extreme Programming: JUnit
    Google Preview: Capítulo 4 do livro Java Extreme Programming Cookbook, por Eric M. Burke e Brian M. Coyner, O'Reilly Media, Março 2003, ISBN 0-596-00387-0.
  • Apache Jakarta Cactus
    Cactus is a simple test framework for unit testing server-side Java code (Servlets, EJBs, Tag Libs, Filters, ...). The intent of Cactus is to lower the cost of writing tests for server-side code. It uses JUnit and extends it. Cactus implements an in-container strategy, meaning that tests are executed inside the container.
  • Ejb3Unit
    Ejb3Unit - out of container EJB 3.0 testing - Automate your ejb3 testing. The Ejb3Unit project automates Entity and Session bean testing outside the container for the EJB 3.0 specification. Ejb3Unit is a JUnit extention and can execute automated standalone JUnit tests for all EJB 3.0 conform JEE projects. Ejb3Unit is released under the LGPL License.
  • StrutsTestCase for JUnit
    StrutsTestCase for JUnit is an extension of the standard JUnit TestCase class that provides facilities for testing code based on the Struts framework.

Cobertura de Testes

  • EMMA
    EMMA is an open-source toolkit for measuring and reporting Java code coverage.
  • Cobertura
    Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.
  • Coverlipse
    Coverlipse is an Eclipse plugin that visualizes the code coverage of JUnit Tests. It is unique for it integrates seamlessly in Eclipse.

Ofuscadores & Otimizadores

  • ProGuard
    ProGuard is a free Java class file shrinker and obfuscator. It can detect and remove unused classes, fields, methods, and attributes. It can then rename the remaining classes, fields, and methods using short meaningless names. The resulting jars are smaller and harder to reverse-engineer. ProGuard is a fast command-line tool with an optional graphical user interface. ProGuard is free, under a GPL license.
    ProGuard alternatives.
  • Java Optimize and Decompile Environment (JODE)
    JODE is a java package containing a decompiler and an optimizer and obfuscator for java. This package is freely available under the GNU GPL.
  • jarg - Java Archive Grinder
    The jarg makes smaller a jar file in whitch java classes are stored. jarg is an open source software, distributed under BSD License.
  • RetroGuard
    Java Bytecode Obfuscation. By Retrologic Systems. Escrito em Java, suporta JDK 1.1 a 1.5 e J2ME. RetroGuard é distribuído sob licenciamento dual: GNU GPL sem custo para uso não-comercial, ou licença e suporte anual pagos para uso comercial.
  • yGuard

Descompiladores

  • Java Optimize and Decompile Environment (JODE)
    JODE é um pacote java contendo um descompilador e um otimizador e ofuscador para java. Este package é livremente disponível sob a licença GNU GPL.
  • DJ Java Decompiler
    DJ Java Decompiler é um descompilador e disassembler Windows para Java que reconstrói o código fonte original a partir de arquivos binários CLASS compilados. Ele é uma aplicação Windows independente (não requer Java instalado), usando Jad como seu mecanismo de descompilação, incluindo um editor gráfico de fonte Java com coloração de sintaxe. DJ Java Decompiler é escrito e suportado por Atanas Neshkov é um software gratuito.
  • JAD - the fast JAva Decompiler
    Jad is a Java decompiler, i.e. program that reads one or more Java class files and converts them into Java source files which can be compiled again. Jad is a 100% pure C++ program and it generally works several times faster than decompilers written in Java. Jad doesn't use the Java runtime for its functioning, therefore no special setup is required. Jad can be used: for recovering lost source codes; for exploring the sources of Java runtime libraries; as a Java disassembler; as a Java source code cleaner and beautifier. Jad é gratuito para uso não-comercial.
  • JReversePro - Java Decompiler
    JReversePro é um Java Descompilador / Disassembler escrito inteiramente em Java. Este utilitário de engenharia reversa está sob a Licença GNU GPL.
    Projeto SourceForge: JReversePro. JReversePro @ Blogspot.
  • Java Decompiler HOW-TO
    At TLDP - the Linux Documentation Project. (LinuxDoc link).
  • Java decompilers compared
    By Dave Dyer, JavaWorld July 1997.
  • Mocha, the Java Decompiler
  • Java Decompilers
    By Program-Transformation.Org.