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
官方网站:点击访问星梦云活动官网活动方案:机房CPU内存硬盘带宽IP防护流量原价活动价开通方式成都电信优化线路4vCPU4G40G+50G10Mbps1个100G不限流量210元/月 99元/月点击自助购买成都电信优化线路8vCPU8G40G+100G15Mbps1个100G不限流量370元/月 160元/月点击自助购买成都电信优化线路16vCPU16G40G+100G20Mb...
2021年恒创科技618活动香港美国服务器/云服务器/高防全场3折抢购,老客户续费送时长,每日限量秒杀。云服务器每款限量抢购,香港美国独服/高防每款限量5台/天,香港节点是CN2线路还不错。福利一:爆品秒杀 超低价秒杀,秒完即止;福利二:云服务器 火爆机型 3折疯抢;福利三:物理服务器 爆款直降 800元/月起;福利四:DDOS防护 超强防御仅 1750元/月。点击进入:2021年恒创科技618活...
搬瓦工最近上线了一个新的荷兰机房,荷兰 EUNL_9 机房,这个 9 的编号感觉也挺随性的,之前的荷兰机房编号是 EUNL_3。这次荷兰新机房 EUNL_9 采用联通 AS9929 高端路线,三网都接入了 AS9929,对于联通用户来说是个好消息,又多了一个选择。对于其他用户可能还是 CN2 GIA 机房更合适一些。其实对于联通用户,这个荷兰机房也是比较远的,相比之下日本软银 JPOS_1 机房可...
highlighter为你推荐
操作http腾讯社交效果广告toupian小学语文 拼音表企业cms企业站cms哪个好ym.163.com免费企业邮箱cuteftp什么是CuteFTP?如何将网站内容上传(FTP)到网站空间?美要求解锁iPhoneiPhone连接Mac的时候出现提示需要解锁iPhone支付宝是什么什么是支付宝? 请详细介绍.asp.net网页制作如何用DREAMWEAVER ASP.NET 做网页piaonimai这位主播叫什么
移动服务器租用 云网数据 GGC 百兆独享 广州服务器 789电视剧 美国凤凰城 lamp怎么读 服务器硬件配置 卡巴斯基试用版下载 闪讯网 香港ip privatetracker windowsserver2008 美国代理服务器 最新优惠 qq空间打开很慢 easypanel tko linuxvi命令 更多