NetBeansNewfeaturesandimprovementsinthenextreleaseofNetBeansmakeitabetterIDEforanykindofdeveloper.
Fromeditingtobrowsing,versioning,building,debugging,profilingorvisualdesign,therearegreatnewsforeverybody.
NewCoreFeaturesinDepthOsvaldoDoederlein6.
0IssueThreeNNetBeans6.
0:NewCoreFeaturesinDepthIt'sthattimeagain.
Amajor,dot-zeroreleaseofNetBeanswillbeavailablesoon–aboutayearandahalfafter5.
0,whichintroducedsignificantnewfeaturesliketheMatisseGUIbuilder,andextensiveimprovementsinCVSintegration,webservicesandmoduledevelopment,tocitebutafew.
Incontrast,version5.
5focusedoutsidethecoreIDEbysupportingseveralnewPacksthatincreasedNetBeans'over-allfunctionalitytoalevelstillunmatchedbyanyotheropen-sourceIDE.
Now,isNetBeans6.
0worthyofthebumpinthemajorversionnumberYoubetitis,andinthisarticlewe'lllookatsomeofthemostimportantandinterestingnewfeaturesinthecoreIDE.
Javac-poweredLet'sbeginbylookingnotatanend-userfeaturebutatacoreIDEtechnologythatprovidesthefoundationformanyenhance-ments.
PastreleasesofNetBeans,likemanyotherprogrammingtools,containedcustomcodetoparseJavasourcesandassistincodeunderstandingandmanipula-tiontasks(likerefactorings,hintsandfixes,outlining,etc).
Theresultwassometimeslimitedfunctionality:simplehighlighting,non-bulletproofrefactorings,andthelackofsupportforfeatureslikecodecomple-tioneverywhereJavacodeappears.
TheobvioussolutionwouldbereusingthematuretechnologyofthejavaccompilertodoallJavasourceprocessing.
ButjavacwasnotdesignedtosupporttherequirementsofamodernIDE:itwaswrittenandtunedforbatchexecution,andtoacceptasinputfullcompilationunits,performacompletecom-pilationandproduce.
classfilesasoutput.
IDEshaveverydifferentrequirements,amongwhichthemostcriti-calisworkinginmemoryonly.
Supposethataftereachcharacteryoutype,theIDEwantstoanalyzetheentireclassagainsoitcanupdatesyntaxerrorindications,performhighlighting,andprovideotherfeaturesthatdependonthecodestructure.
Oneoptionwouldbetowritetheeditor'scurrentcontenttoatemporaryfile,invokejavacandparsetheresulting.
classfiles.
Butthiswouldbeveryinefficient.
Amuchbettersolutionistocalljavacinthesameprocess(asalocallibrary),thenpassthecurrentsourcesasanin-memoryparam-eterandreceiveinreturnthedatastructurescontainingthesameinformationthatwouldbepresentintheclassfiles(whichwouldn'tneedtobecreated).
UptoJavaSE5,thissolutionwouldbepos-sible,butonlyusingtheproprietary–andoftenunstable–internalAPIsofaJavacompiler.
ThissituationchangedwithJavaSE6,whichintroducedJSR199(JavaCompilerAPI)andJSR269(PluggableAnnotationProcess-ingAPI).
TheJavaCompilerAPIenablestightandefficientintegra-tionwithjavac(andotherJavasourcecompilers),andJSR269–althoughinitiallydesignedforannotationprocessing–providesasource-levelequivalentofreflectionmetadata.
Workingtogether,thesenewAPIsallowIDEsandothertoolstodigdeeplyintothestructuralinformationthatjavacextractsfromsourcecode.
Addi-tionally,javac'simplementationwasenhancedandtunedforembed-dedandinteractiveuse.
NetBeanswasheavilyupdatedtointegratewiththesenewcapa-bilities,enablingmanyimprovementsintheIDE(discussedbelow).
Thechangesalsopromisefuturebenefits:whenJavaSE7comesoutwithanewsetoflanguageenhancements,youshouldexpectNetBeans'toolsettocatchupveryfast.
AneweditorCommonsensesaysnoproductcanbeperfectineverythingitdoes,butNetBeansisgettingclosereachday.
Historically,Net-BeansusershavebeenproudoftheIDE'scompletecoverageofJavaplatformsfromMEtoEE,itssupportforeffectiveGUIbuilding,anditsintuitiveUIandopenarchitecture.
Ontheotherhand,theIDElaggedincertainareas,likeinthecodeeditororrefactoring.
Thiscouldputoffprogrammersveryfocusedinsourcecode…typeswho'llpickemacsovervisualdesignersanyday.
Well,theseprob-lemsarenomorewithNetBeans6.
0.
IssueThreeNjackpot.
netbeans.
orgTheJackpotproject.
www.
netbeans.
info/downloads/dev.
phpNetBeans6.
0developmentbuilds.
CoreIDENNetBeansMagazineAST-basedselectionSelectingwordsorlinesisgoodenoughfortexteditors,butwhenworkingwithsourcesyouoftenneedtoworkwithrangesoftextthatformcoherentpiecesofcode.
Sayyouwanttocopyallthecodeinsideaforloopbody1inordertopasteitinanotherloopwithsimilarlogic.
Justplacethecursorinanyblankpositioninsidetheloopbody,pressAlt+Shift+Upandyou'redone.
Theeditorselectstheinnermostrangeoftextthatincludesthecursorposition,anddelimitsanodeofthesource'sAbstractSyntaxTree.
TheJavacompiler(asdomostcompilers)parsessourcecodeintoanintermediaryrepresentation,whichisstructuredasatree.
Eachnodeinthisdatastructure(calledanAbstractSyntaxTree)representsacodeelement:aclass,method,statement,block,identifier,operator,literal,etc.
ThoughcodeprocessingtoolsusuallymanipulateprogramsasASTs,manyuseasimpleparserthatproducesonlyabasictree.
The"full"ASTproducedbyacompletecompilerlikejavac,whichiscapableofsemanticanalysisandcodegeneration,willcontainverydetailedandreliableinformationabouteachnode.
Forexample,thenodeforanidentifierholdsnotonlyitsnamebutalsoitstypeandits"definiteassignment"status(whethertheidentifierisguaranteedtobeinitializedatagivenpoint);itcanevenholditsstatically-calculatedvalue(whenapplicable).
ToolsthatworkontopofafullASTaremuchmorepowerfulandreliable.
Thedifferencewon'tbenoticeableforasimpleselectionfeature,butitmaybeverysignificantformoresophisticatedfunctionalitylikerefactorings.
EPressingAlt+Shift+Upagainexpandstheselectiontothenextouternode,inthiscasethecompleteforstatement;thenanewkey-strokemayselecttheentiremethod,andsoforth.
Alt+Shift+Downwillretracttheselectiontoaninnernode.
Figure1showsthisfeaturebeingusedtoselectamulti-linestatementeasilyandprecisely.
Ibetyouwillquicklybehookedonthisfeatureandforgetaboutalltheotherselectionshortcuts!
There'snothinglikeacodeeditorthatgrokscode,nottext.
SemantichighlighterTheeditor'ssyntaxhighlighterwaspro-motedtoasemantics-awarehighlighter.
Itcanapplystylesbasednotonlyonthetypesoftokens(likeidentifiers,operatorsorcomments),butalsobasedondifferentmeaningsthatakintokensmayhave–forinstance,anidentifiermaybeaclassnameoralocalvariablename,aparameter,aconstantfield,etc.
1Dependingonyourbracingstyle,thismaynotbeaseasyasselectingafewfulllines.
Therearemanyotherexamples,likeselectingacomplexexpressionthatspansmultiplelines.
Figure1Severalneweditorfeaturesinaction.
ASemantichighlighting(e.
g.
,identifyingusagesofgetImage(),andstaticvariablesinitalics)Keywordcompletionatamethod'sparameterlist.
Hierarchyview(openedonPaintCanvas)AST-basedselectionIssueThreeNNetBeans6.
0:NewCoreFeaturesinDepthOnebenefitofsemantichighlightingisthatithelpsyoutakeextracarewhenas-signingtostaticfields(sincemanythread-safetyandmemory-leakbugsinvolvestat-ics).
Figure1showsthisoff;noticethatstaticfields(andreferencestothese)ap-pearinitalics.
Thereareotherpowerfulusesforthenewhighlightingengine:Identifyingusages–Selectanyidenti-fier,andtheeditorhighlightsallitsusesinthesamecompilationunit.
Again,Figure1exemplifiesthis:clickingonamethodname,allinvocationstoitarehigh-lighted.
Flagging"Smellycode"–Theneweditorhighlightsunusedvariablesandimports,aswellasusageofdeprecatedclassesandmethods.
Youdon'tneedtoperformabuildorrunacodelinttooltodetectthesesim-ple(butfrequent)problemsanymore.
Exitandthrowpoints–Selectingamethod'sreturntypewillhighlightallreturnstatements.
Selectinganexceptioninthemethod'sthrowslistwillflagallthrow'softhatexceptiontype.
Allinvocationstoothermethodsthatmaythrowthesameexcep-tionarealsoflagged.
BettercodecompletionThebewilderingamountofAPIsyouhavetousethesedaysmakescodecompletiononeofthemostcriticalfeaturesofanymoderncodeeditor.
NetBeans6.
0haslearnedmanynewtrickshere:Keywordcompletion–Ifyou'vejusttypedapackagedeclarationinanewsourcefile(forexample),Alt+Spacewillbringonlythekeywordsthatarelegalinthatposition:abstract,class,enum,final,import,inter-faceandpublic.
Figure1showsanotherexample:aftertheopeningparenthesisofamethoddeclaration,thepreferredcompletionsareallprimitivetypes.
Type-basedvariablenames–Completingat"ConfigurationFile_",theeditorwillofferthevariablenamescf,configurationFileandfile.
(I'musing"_"torepresentthecursorposition.
)Generics-awarecompletions–Whenassigningavariablewithagenerictypetoanewexpression,theeditorwillofferallcompatibletypes,includinggenericarguments.
Forexample,at"Mapm=new_",codecompletionlistsallimplementationsofMap,eachwiththesameparameters.
Annotation-awarecompletions–Whencompletingafter"@",you'llbeofferedalltheannotationsthatcanbeusedinthegivenscope.
Andiftheselectedannotationrequiresparameterstheeditorwillprovidecompletionsforthesetoo.
Passingparameters–At"x=m(_",thetopcompletionswillbevaluesinscopethatarecompatiblewithm()'sfirstparameter.
Ifthemethod'sparameternamesareavailableandtherearevariableswithsimilarnamesinscope,thisisusedtosortthecompletionsfurther.
You'llalsobeofferedfullcompletionswiththeparameterlistfilledwiththosevariables.
Commonconstructors–Whenyouinvokecodecompletionwiththecursorpositionedbetweenclassmembers,you'llbeofferedtocreateaconstructorwithoutargumentsandonethatreceivesinitialvaluesforallfields(iftheseconstructorsdon'talreadyexist).
Catchingexceptions–Completionat"catch(_"willonlyofferex-ceptionsthatarethrowninthecorrespondingtryblock,buthaven'tbeenhandledyetbypreviouscatchblocks.
NewbrowsingviewsTheeditorintroducesseveralnewviewsforsourcecodebrowsing.
TheMembersviewshowsthemembersofaJavatypetogetherwiththeirjavadocs,makingiteasytofindaparticularmethod,fieldorinnerclass.
TheHierarchyviewshowstheinheritancetreeofaJavatype.
Figure1demonstratesthisview;noticethefilterbuttonsthatletyoutogglebetweensupertypesorsubtypesandbetweensimpleandfullyqualifiedclassnames.
Youcanalsochoosewhetherornottoshowinnerclassesandinterfaces.
TheDeclarationviewsummarizesthedeclarationoftheselectedJavaelement(type,methodorfield).
Despiteitsname,thisviewalsoshowstheinspectedelement'ssourcecodeifit'savailable.
TheDeclarationViewisespeciallyusefulwheninvokingcodestillunderCoreIDENNetBeansMagazine2Adevelopment,notyetdocumentedwithjavadoc.
Finally,theJavadocviewshowsthejavadocsfortheselectedJavaelement.
EditableDiffandInlineDiffTheeditor'simprovedarchitecturemakesiteasierforvariousfea-turesthathandlesourcecodetointegrateeditorfunctionality.
ThisisnoticeableinthenewDiff(opened,forexample,byselectingasourcefileandchoosingSubversion>Diff).
Whenit'sshowingalocalfile,therightpaneiseditable,providingthefullsetofeditorfeatures–seman-tichighlightingandcodecompletionincluded.
ThenewDiffaddsotherinterestingtricks,likeone-clickmergingandword-leveldiff(ifasinglewordischangedinaline,onlythatwordishighlighted).
CheckouttheseimprovementsinFigure2.
YoucanalsoenableanInlineDifffeature,whichcreatesaDiffside-bar,highlightingupdatedsectionsofaversionedfile.
Thesidebarletsyouvisualizeorrollbackchanges,andopenthefullDiffview.
JavadochintsYoualwaysdocumentallyourcode,rightWell,ifyoudon't,Net-Beanswillcomplainaboutmissingandincorrectjavadoctags.
TheIDEcanhelpyouwithautomaticfixesthataddthemissingtags,onlyaskingyoutofillintheblanks.
Andwhileyou'redoingthat,youcanusethenewJavadocviewforconvenientpreviewing.
Javadoccheckingisactivebydefault,butit'snotintrusive:theedi-torwillreportmissingjavadoctagsjustfortheselectedline;onlyincorrecttagswillbereportedeverywhere.
YoucancustomizetheseandrelatedoptionsthroughTools|Options>JavaCode>Hints.
OtherfeaturesTheneweditoranditsframeworkincludeothergeneralfeatures,likereusableeditortabs.
Theseareusefulforthedebugger,toavoidclutteringyourenvi-ronmentwitheditorsopenedbybreakpointsorstep-into's.
There'salsoanewGenerateCodedialogthatautomatesthecreationofconstructors,gettersandsetters,equals()andhashCode(),anddelegatemethods.
RefactoringandJackpotNetBeans6.
0improvestheexistingrefac-toringsupportextensively.
Thereisanewinternallanguage-independentrefactoringAPIthatwillallowimplementingrefactoringsforcodeotherthancommon.
javasources(e.
g.
,XMLorJSFfiles).
ThenewAPIalsoallowsJavarefactoringstopreciselyupdatedependentnon-Javaelements.
Thisshouldmakethecurrentrefactoringssaferandeasiertouse.
Thebignewshere,though,isthebreak-throughnewtechnologyfromprojectJack-pot,whichhasbeenavailableforsometimebutisonlyreachingmaturitynow.
WithitsinclusioninNetBeans6.
0,JackpotwillbepromotedtoastandardfeatureandbemorecloselyintegratedwiththeIDE.
YoumayhaveheardthatJackpotisanewrefactoringtool,butthisreallydoesn'tmakeitjustice.
Jackpotisactu-allyacomprehensiveframeworkforgen-eralcodeunderstandingandmanipula-tion.
Youcanuseitasareplacementorfoundationforseveralkindsoffeatures:refactoringsupport,advancedsearchingandbrowsing,qualityinspection,macro-likeautomationofcomplexeditingtasks,andmore.
UsingJackpotBeforetakingamorein-depthlookatJack-pot,let'sshowhoweasyitistouse.
ThenewFigure2TheLocalHistoryandthenewDiff:editingcapability,semantichighlightingandword-leveldiff.
AIssueThreeNNetBeans6.
0:NewCoreFeaturesinDepth4A3AQueryandRefactorcommandwillshowadialoglikeFigure3,whereyoucanpickaJackpotqueryorqueryset.
Somequerieshaveoptionsthatyoucansettopreferredvalues.
ClickQuery,andanymatchesfortheselectedquerieswillappearinaviewthatdetailseachmatch.
Also,ifthequeryinvolvescodechanges,youcanpreviewandconfirmthesechangesbyclickingonaDoRefactoringbutton.
JackpotrulesJackpot'sfullpowercomesfromitsopen-ness.
ThisrequireslearninganewlanguagebutwhenyourealizeJackpot'sfullpotentialyouwillseethatthelearningcurvequicklypaysoff.
Forexample,hereisaJackpotquerythatdetectsaninefficientcodepattern–theuseofequals("")tocheckifaStringisempty–andrewritesthematchingcode:$s.
equals(s.
length()==0)::$sinstanceofjava.
lang.
String;Thesyntaxispattern=>replacement::condition,wherethe$characteridentifiesmeta-variablesthatwillbindtoanyJavaprogramelement(identifier,statement,operator,literal,etc.
).
Let'sanalyzeeachclause:1.
Thepattern$s.
equals("")matchesinvocationstotheequals()methodthatpassanemptystringasargument.
2.
TheconditionistheonlyoptionalpartofaruleinJackpot'srulelanguage,butit'sacriticalpartinthisparticularrule:$sinstanceofjava.
lang.
Stringmakessurethattheruleonlyfireswhen$sisaString.
That'sanimportantconstraint,sinceourruleisspe-cifictousesofjava.
lang.
String.
equals(),andnottojustanyimplementationofequals().
3.
Finally,thereplacement–($s.
length()==0)–re-writesthematchingcode.
There'salotofsophisticationbehindthisapparentlysimplebehavior.
Foronething,lookatJackpot'sinstanceofoperator.
ItwalksandquackslikeJava'sinstanceof,butit'snotthesamething.
Java'sinstanceofisaruntimeoperatorwhoseleft-handoperandisanobjectreference.
Jackpot'sinstanceof,however,isacom-pile-time(static)operator;itsleft-handoperandisanynodeoftheprogram'sAST.
BecauseJackpot–liketheneweditor–reliesonjavac'ssourceanalysisengine,it'sabletofullyattributealltypesintheprocessedcode.
Thisincludesthemostcomplexcases,likeinferredgenerictypes.
Othercodeanalysistoolsoftenresorttoheuristicsthatapproximatetypesbutmightfailtocalculatetypesforsomeex-pressions.
Youcouldeventrytodoourrefactoring(replacings.
equals("")bys.
length()==0)usingplainregularexpressions:searchfor(\w*)\.
equals\andreplaceitwith$1.
length()==0.
Butregexesarerigidanddumb;theywon'tEFigure3Jackpot'sQueryandRefactordialog.
AFigure4Jackpot'sRefactoringManager.
ACoreIDE10NNetBeansMagazineevenexcludetextthat'sinsidecommentsorstringliterals,andasimplelinebreakwillpreventdetection.
Thisisobviouslyastrawmanexample(othertools,likePMDandFindBugs,aremuchsmarterthanregexes–althoughnotuptojavac-likeprecision),butitshowsthevalueofsmartertools/features.
ThereareJackpotoperatorswithoutJavacounterparts,fromsimpleoneslikeisTrue(node),whichmatchesbooleanexpressionsthatcanstaticallybeproventoalwaysevaluatetotrue–tomorepowerfuloperatorslikeisSideEffectFree(node).
Thelattermatchesastatement,blockormethodthatdoesn'tmodifyanyvariableout-sideitsscope.
Again,suchdetectionsresembleexistingcodeinspectiontools,whichdetectproblemslike"deadcode".
ButJackpot'srelianceonthefulljavactechnologyresultsinfewerfalsepositivesindetec-tions,andhighersafetyinautomaticreplacements.
YoucanalsowriteJackpotqueriesinplainJava,usingJackpotAPIsandNetBeans'moduledevelopmentfeatures.
ThisisnecessaryforcomplexrulesthatgobeyondthecapabilitiesofJackpot'srulelanguage.
Butasthislanguageevolves,fewerandfewerqueriesshouldrequireimplementationinJava.
Performance,bytheway,isnotanissue:querieswrittenintheJackpotrulelanguageareconvertedtoJavaandexecuteascompiledcode.
Figure4showsJackpot'sRefactoringManager.
Thisconfigura-tiondialogallowsyoutoinspectallinstalledqueriesandorganizethemintoquerysets.
Youcanalsoimportnewqueries.
Ifyouwriteanewqueryscript,justclickImportandthenewquerywillbeavail-ableintheQueryandRefactordialog.
UsageandperspectivesJackpotshipswithalibraryofpredefinedqueries,containingmanyrulesforcodeclean-upanddetectionofcommonprogrammingmis-takesorcodeanti-patterns,aswellasmigrationofdeprecatedAPIusage.
AsIwritethis,JackpothasjustbeenintegratedintoNetBeans.
SowehaveahybridsystemwithJackpotco-existingwithtraditionalrefactoringandcodemanipulationfeatures.
Thismeansthatcom-mandslikeRenamemethodarestillimplementedintheold-fashionedway,eventhoughtheycouldbeimplementedbyaJackpotrule.
Thesameholdsforcodevalidations("hints")andtheirautomaticfixes.
Someofthisfunctionalitywillcertainlybere-E5AimplementedonJackpotinthefuture.
Also,becauseJackpotmakesthedevelopmentofsuchthingsmucheasier,youshouldexpectanincreasingnumberofrefactorings,vali-dationsandothercode-crunchingfeaturestobeaddedtotheIDE.
ExtendedAntandJUnitsupportAntsupportinNetBeans6.
0hasbeenup-datedtoAnt1.
7.
0,amajornewreleasethataddssuchfeaturesassupportforJSR223-compatiblescriptinglanguages.
There'salsoanewprogressindicatorforAntpro-cesses.
TheIDE'sJUnitsupportnowhandlestheannotation-driventestcasesofJUnit4.
OldJUnit3.
8testcasesarestillsupported.
Also,theprojectpropertieseditorisim-provedwithclasspathentriesspecifictounittests.
ProjectandbuildfeaturesEditingcodeisfundamental,butformostnon-trivialprojectsawell-structuredandpowerfulbuildsystemiscriticaltoo.
NetBeans'projectmanagementandbuildsystemwasimprovedwithmanynewfea-tures.
InadditiontoitsAntsupport,NetBeanscanopenandunderstandApacheMaven2projects.
ThoughthenewMaven-basedproj-Figure5MultipleConfigurationsandsupportforJavaWebStartinthenewProjectPropertiesdialog'sRunpage.
AIssueThreeN11NetBeans6.
0:NewCoreFeaturesinDepthectsupportisnotintendedtoreplaceAntprojectsanytimesoon,itwillbewelcometoMavenfansortoanybodyneedingtobuildaprojectthatrequiresMaven.
Also,nowyoucanspecifypackagesorclassestoexcludefromthesourcetree.
Thisisusefulforworkingwithlargeproj-ects,whenyou'renotinterestedinseeingorrunningalloftheircodeandapartialbuildisviable.
Ifyouhavemanycorrelatedprojects,youcanorganizethemintoProjectGroups,socertainoperationslikeopeningprojectscanbeappliedtothegroupasawhole.
AndifyouwriteJavaSEprojectswithmanyentrypoints(classeswithmain()methods),orwithcommand-lineparametersthatre-quirefrequenteditsoftheprojectproper-ties,theRunConfigurationsfeaturewillmakeyourlifeeasier.
Theprojectproper-ties'RunpageshowsanewConfigurationoption.
Eachconfigurationallowsyoutodefinethemainclass,argumentsandVMoptions,independentlyofotherconfigura-tions.
SeeanexampleinFigure5.
Furthermore,thenewJavaWebStartsup-portautomatesthecreationandmainte-nanceofJNLPfiles,andmakesiteasiertoruntestswithoutneedingabrowser.
IntheProjectProperties,checkApplication>WebStart>EnableWebStart,andoffyougo.
JavaWebStartsupportintegrateswiththeRunConfigurationsfeature,bycreatingaWebStartconfiguration.
SoyoucantestthesameprojectwithorwithoutJAWS.
VersioncontrolRobustversioncontrolisanessentialfea-ture,evenforsimpleprojectswrittenbyonedeveloperoveraweekend.
Foronething,it'scriticaltoenable"fearlessprogram-ming",e.
g.
usingtechniqueslikerefactoring(manualorautomatic)withoutworry.
NetBeans6.
0bringsplentyofnewsinthisareatoo.
CVSNetBeanshastraditionallysupportedtheCVSversioncontrolsys-temandthissupportwasalreadyexcellentinNetBeans5.
5.
Version6.
0addsseveralupdatesinusability,likeexportingadiffpatchoffilesselectedintheSearchview;anewcommandtoopenaspecificrevision,tagorbranch;andanimprovedhistorysearchfeaturewithnewSummaryandDiffviews.
Therearealsonewadvancedopera-tionslikechangingtheCVSrootanddoingapartialmerge.
SubversionThebiggestnewsformanyusers,though,issupportforthein-creasinglypopularSubversionversioncontrolsystem.
NetBeans6.
0isthefirstreleasetointegratecompletefirst-classsupportforSVN.
EventhoughNetBeans5.
5nowoffersaSubversionmoduleintheUpdateCenter,youreallywantversion6.
0ifyouareaheavySubversionuser.
LocalHistoryNomatterwhichVersionControlSystemyouprefer,you'lllovethenewLocalHistoryfeature,alreadydepictedinFigure2.
NetBeans6.
0automaticallykeepsaninternalhistoryofrecentchangestoprojectresources.
Everytimeyousaveafile,thisisregisteredasa"commit"ofanewversionofthefileinthelocalhistory.
Sofilechangesaretrackedwithfinegranularity–somewhatlikeapersis-tentundofeature.
Youcaninspectthe"versions"inthelocalhistoryanddiffthemagainstthecurrentfiles.
Bewarned,however,thatthisfeatureismostlyusefulforundoingmistakesthatescapetheeditor'sundocapacity,e.
g.
afterclosingtheeditororrestartingtheIDE.
Youcanthenreverttoapreviousstatethatyouhaven'tyetcommittedtoasaferVCSrepository,per-hapsbecausethenewcodewasstillroughanduntested.
TheLocalHistoryfeatureispowerfulandissometimesalifesaver,butit'snotafullreplacementforarealVCS.
DebuggingThedebuggerisofcourseamongthemostcriticalfeaturesofanIDE,andNetBeansisalreadyverycompleteinthisarea.
Sowhat'slefttoimprovein6.
0Firstoff,theJavaSE6releasecontainstwonbi.
netbeans.
orgThenewNetBeansInstaller.
Asofthiswriting,youmustfollowalinktoadirectorywhereyou'llnavigatetotheinstallerpageforaspecificbuildCoreIDE12NNetBeansMagazineimportantnewJVMdebuggingfeatureswhichrequireanupdatedde-buggertouse.
(ThedebuggersfromNetBeans5.
5orolderreleaseswon'tbenefitfromtheseevenifyourunthemontopofJavaSE6.
)TherearealsootherdebuggerimprovementsthatarenotdependentontheJREversion,soyou'llbenefitevenifyouarechainedtosomestone-ageJavaruntimelike5.
0or,heavensforbid,1.
4.
2.
ForcingreturnvaluesSupposeyou'resteppinganywhereinamethodandyou'dliketoforceittoreturnimmediatelyandproduceaspecificreturnvalue.
Thisisnowsupportedinthe6.
0debugger,lettingyoucheck"what-if"scenariosandreproducebugsmoreeasily.
Youwon'tneedhackslikepatchingthesourcecodewithreturnstatements(andhavingtounpatchitlater).
AsIwrite,thisfeatureisnotyetimplemented,butitshouldbebeforethefinalrelease.
ExpressionsteppingExpressionsteppingisanothersmarttimesaver.
Incomplexexpres-sionscontainingmethodcalls,youcanstepintoindividualinvoca-tions,andwhensuchacallreturnsyoucanseethereturnedvalueevenit'snotassignedtoanylocalvariable.
Younolongerhavetobreakexpressionsintosimplepartsandintroducetemporarylocalsforthesinglepurposeofhelpingdebugging.
Also,theLocalVariablesviewwillshowthevaluereturnedbyinvokedmethods.
ExpressionsteppingwillworkinanyJavaruntime,butshowingval-uesreturnedbyinvokedmethodsrequiresJavaSE6.
MultithreadingsupportAnothernewfeaturethat'sveryusefulisDebugcurrentthread:youcaninstructthedebuggersothatonlyagiventhreadwillstopinbreakpoints.
Thisiscrucialfordebuggingconcurrentapplicationsthathaveseveralthreadsrunningthecodeofinterest.
Sincewedevelopersarenotmultithreaded,we'reeas-ilyoverwhelmedwhensettingabreakpointcausesthedebuggertostoptwentythreadsatonce!
OtherfeaturesTherearealsogeneralimprovementstootherfeatures,likebetterhandlingofbrokenbreakpoints(e.
g.
withincor-rectconditions),andacommandtocopycallstackstotheclipboard.
6ANewProfilerfeaturesInNetBeans6.
0,theProfilerbecomespartofthecoredistribution,andthere'sarangeofimportantimprovements.
Betterperformance–Performanceisgoodanywherebutit'salwaysacriticalis-sueinprofilers.
TheNetBeansProfiler,whichderivesfromSun'sJFluidresearchproject,pioneeredanewtechnologythatallowspro-filingappsnearlyatfullspeedbydynami-callyinstrumentingcode.
Also,theProfileritselfshouldbefasttoanalyzeandpresentdatacollectedfromtheJVM–especiallyonlinedatathat'sconstantlyupdatedastheprogramruns.
ThenewreleaseimprovessignificantlytheperformanceoftheLiveRe-sultscategorizationanddrilldown,soyou'llfindyourselfusingthisfeaturemoreoften.
Classloadingtelemetry–TheVMTe-lemetryviewnowshowsthenumberofloadedclassestogetherwiththenumberofthreads.
Memorysnapshotcomparison–Yourapplicationhasamethodthat'ssuspectofleakingTakeheapsnapshotsbeforeandaf-terrunningitthendiffthetwosnapshots.
HeapWalker–Theultimatetoolforleakhuntingandanykindofmemoryallocationanalysis.
Youcanloadaheapdumpandvi-sualizethefullobjectgraphintheheap(seeFigure6).
Figure6TheProfiler'sHeapWalker,inspectingaparticularinstanceofBigInteger.
AIssueThreeN13NetBeans6.
0:NewCoreFeaturesinDepth2Incidentally,severalmenuoptionsweresim-plifiedinNetBeans6.
0;forinstance,JavaPlat-formManagerbecameJavaPlatforms.
Loadgeneration–TheProfilersupportsintegrationwithloadgenerationtools(cur-rentlyonlyApacheJMeterissupportedbutmoreistocome).
ProfilingPoints–Theseareaprofiler'sequivalentofdebuggerbreakpoints.
Youcandefineplacesinyoursourcecodewheretheprofilershouldstart/stoptheclock,resetprofilingresultsortakeasnap-shot.
TheProfilingPointsfeatureremovesmostbureaucraticprofilingwork:neveragainwillyouneedtosteporpausecodetogetsnapshotsincriticalevents;youalsowon'tneedtotweakcodetomeasurethelatencyofaregionthatdoesn'tcoincidewithafullmethod.
GUIandusabilityAnIDEshouldhaveabeautiful,efficientandproductiveGUIasmuchasanyotherapplication.
NetBeans6.
0makesnewstridesinthisdirection.
LinuxandSolarisuserswillcertainlywel-comethemuchimprovedGTKL&F,whichisnowactivatedbydefaultontheseplat-forms.
Theactivated-by-defaultpartde-pendsonSun'sJRE6Update1(orbetter),whichcontainsitsownshareofimportantGTKupdates.
NetBeanswillrespectallsettingsfromtheactiveGTKtheme.
ThenewNetBeansInstaller(NBI)makesinstallationeasierandfaster.
Inthedown-loadspage,youcanselectwhichpacksyouwant(e.
g.
Enterprise,Mobility).
Thenyou'llbeofferedacustominstallerthatincludesallchosenfeaturesandwillin-stalltheseinasinglego.
NBIisespeciallyconvenientforsystemadministratorsthatneedtoinstallthesameIDEconfigurationinmultiplemachines,andfortrainerswhooftenlandinunpreparedlaboratories.
NetBeansalsoincludesredesignedicons,andtheSDIwindow-ingoption(arelicfromancientNetBeansreleases)wasremoved.
Nowyouhaveundockable/floatingwindows.
Finally,intheQAfront,thenewReportExceptiontoolstreamlinesreportingofdetaileder-rordatatoNetBeans'developers,whiletheUIGesturesCollectorcansubmitdataaboutyourIDEusagepatterns.
Thisdataisusefulnotonlyforresearch,butalsotoimplementakindof"tipoftheday"hintsystemnotbasedonMath.
random().
Itestedthis,andtheNetBeansAnalyticssiteofferedmeatutorialaboutprofilingmultithreadedprograms,whichwashighlycorrelatedwiththetasksIhadbeenperforminginrecentdays.
MatisseandvisualwebdevelopmentThereareonlytwocoreIDEfeaturesI'mnotcoveringhere.
Bothareaward-winningtoolsandtopreasonsformanydevelopershav-ingmovedtoNetBeans:theMatissevisualeditor,andtheVisualWebPack.
NetBeans6.
0bringssignificantupdatestoboth.
ForMatisse,checkoutthearticle"UIDesigninNetBeans6.
0"inthisissue,whereyou'llfinddetailedinformationaboutwhat'snew.
Currently,themostimportantchangesintheVisualWebPackrefertoitsintegrationintotheNetBeanscore.
Actually,therewon'tbeanexternalWebPackfor6.
0.
TheIDEalreadyofferedsupportforwebapplicationdevelopment,soitwasalittleoddtohavesomeofthatinthecoreandtherestinanexternalPack.
Historically,thishappenedbecausetheWebPacktechnologywasoriginallydevel-opedasaseparateproduct(Sun'sJavaStudioCreator),whichwasbasedonaforkofaveryoldNetBeansversion.
Soitsimplementa-tionbecamepartiallyredundantwithNetBeans'webtooling.
Nowthischasmisclosedandtherewillbenomoreduplicatecodeoreffort.
ThemergeresultsinasimplerIDEforallusers:fromvisual-designloverstotag-writingdiehards.
Thereareseveralnewfeaturesintheintegratedwebtoolingbutaswewritetheyarestillunderheavydevelopment,soitwasn'tviabletocoverthenewfunctionalityinthisissue.
However,don'tmissthearticle"VisualWebApplicationDesignwithNetBeans"foranupdatedtutorialonthelaststableversion.
PluginManagerNetBeans'open,extensiblearchitectureisoneofitscoreadvan-tagesandit'salsoveryeasytouseandintegratewith.
YoumaybesurprisedthattheTools>UpdateManagerhasdisappeared,though.
CoreIDE14NNetBeansMagazine7AButjustlookagain,atTools>Plugins2,andyou'llseeFigure7.
ThenewUIunifiesandbetterorganizestheoldUpdateCenter(seetheUpdates,NewPlugins,DownloadedandSettingstabs),andalsotheoldmodulemanager(seetheInstalledtab).
Therearenewfea-turestoo:forexample,whenyouselectaplugin(likewedidfortheJMeterModuleinFigure7),aRequiredPluginsnodewillappearifapplicable;youcanexpandittoseeanydependenciesthatmustalsobeinstalled.
ConclusionsNetBeans6.
0comeswithamassivenumberofnewandimprovedfeaturesandcertainlydeservesthemajorversionbump.
IfNetBeans5.
5waswide,NetBeans6.
0isalsodeep.
Developersupgradingtothelat-estversionwillhavenotonlyextensivesupportforallkindsofJavadevelop-mentbutalsoabest-of-breedfeaturesetineveryimportantfunctionalityarea.
ManyNetBeanspowerusersmayhavegonethroughthisarticleandfoundfea-turesthatwerealreadyavailableforpre-viousversionsviaadditionalmodules.
FromseveraleditorenhancementstoRunConfigurations,totheLocalHistory,youcouldfindannbmfilethatwouldprovidesomelevelofsupportforyourneed.
However,youcannowjustinstallthecoreIDEandhaveallthesefeaturesoutofthebox–andthey'resuperior,morepolishedandbetterintegratedthanwhat'sprovidedthroughexternalmodules.
Thishappensofcoursewitheverynewrelease,butNetBeans6.
0makesaverynoticeableefforttocatchupwithitsRFEs,embracingalargenumberofimprovementsthatfirstsurfacedascontributionsfromthebroadercommunity.
Thiscanonlybeviewedasgreatnews,andasevidenceofaprojectthatmovesfastinthedirectionus-erswant.
COsvaldoPinaliDoederlein(opinali@gmail.
com)isasoftwareengineerandconsultant,workingwithJavasince1.
0beta.
He'sanindependentexpertfortheJCP,havingservedforJSR-175(JavaSE5),andisaTechnologyArchitectatVisionnaireInformatica.
OsvaldohasanMScinObjectOrientedSoftwareEngineering,isacontributingeditorforJavaMagazineandmaintainsablogatweblogs.
java.
net/blog/opinali.
Figure7ThenewPluginManager.
ACoreIDEWiththisthirdissue,NetBeansMagazineiscompletingitsfirstanniversary.
KudosandthankstotheNetBeansdevelopercommunityforenablingustospreadthewordevenmoreaboutthiswonderfulIDEandPlatform!
1Yearnetbeans.
org/community/magazinemagazineCoreNetBeans6.
0FeaturesKnowindepthwhat'scominginthenewreleaseIntroducingC/C++PackLeverageNetBeansfornativedevelopmentTheblueMarineProjectNetBeansPlatformdevelopmentintherealworldOpenOffice.
orgIntegrationCreateadd-onsandcomponentstointerfacewithOOoProjectSchliemannOpeningtheIDEtootherlanguagesMobilityPackinPracticeLearnthebasicsandreducedevicefragmentationNewUIDesignFeaturesUpgradeyourdesktopproductivitywithNetBeans6.
0VisualWebDevelopmentRapidwebapplicationdesignandimplementationMay.
2007Release6.
0.
JSF.
Matisse.
C/C++.
Mobility.
NetBeansPlatform.
ScriptingLanguagesmagazineReachOutwiththeIDEandPlatform
wordpress公司网站模板,wordpresss简洁风格的高级通用自适应网站效果,完美自适应支持多终端移动屏幕设备功能,高级可视化后台自定义管理模块+规范高效的搜索优化。wordpress公司网站模板采用标准的HTML5+CSS3语言开发,兼容当下的各种主流浏览器: IE 6+(以及类似360、遨游等基于IE内核的)、Firefox、Google Chrome、Safari、Opera等;同时...
至今为止介绍了很多UCLOUD云服务器的促销活动,UCLOUD业者以前看不到我们的个人用户,即使有促销活动,续费也很少。现在新用户的折扣力很大,包括旧用户在内也有一部分折扣。结果,我们的用户是他们的生存动力。没有共享他们的信息的理由是比较受欢迎的香港云服务器CN2GIA线路产品缺货。这不是刚才看到邮件注意和刘先生的通知,而是补充UCLOUD香港云服务器、INTELCPU配置的服务器。如果我们需要他...
4324云是成立于2012年的老牌商家,主要经营国内服务器资源,是目前国内实力很强的商家,从价格上就可以看出来商家实力,这次商家给大家带来了全网最便宜的物理服务器。只能说用叹为观止形容。官网地址 点击进入由于是活动套餐 本款产品需要联系QQ客服 购买 QQ 800083597 QQ 2772347271CPU内存硬盘带宽IP防御价格e5 2630 12核16GBSSD 500GB30M1个IP...
highlighter为你推荐
温州市网络文明传播志愿者信息登记表http500http://bb500.com 这个电影网站安全不?为什么?有人能告诉我吗?不懂的人表乱说浪费你我的时间谢谢dell服务器bios设置戴尔服务器主板怎么设置U盘启动波音737起飞爆胎飞机会爆胎的吗?支付宝注册网站支付宝申请流程是怎么样的??flashfxp注册码找flashfxp3.4注册码宜人贷官网宜信信用贷款上征信吗三友网有了解唐山三友集团的吗?大学生待遇如何,工资收入,福利保障,工作环境等等drupal教程drupal框架初学,请问开发流程是怎么样的,这个框架是对本体做修改,是不是说最后的成品就是这个d店铺统计淘宝店运营每天需要统计哪些数据,我要做个表格
如何注册网站域名 免费注册网站域名 美国主机推荐 gitcafe 论坛空间 台湾谷歌网址 godaddy域名证书 权嘉云 服务器维护方案 双线主机 可外链网盘 爱奇艺vip免费试用7天 百度云1t 申请网页 卡巴斯基免费试用版 河南移动梦网 百度云加速 永久免费空间 申请免费空间 cdn网站加速 更多